ios - How can i add a stylish white color uialertview with activity indicator -
when press 1 button have display 1 white color uialertview activity indicator 5 seconds ? saw codes , select following code ,is enough? how can change color of activity indicator
myalertview = [[uialertview alloc] initwithtitle:@"loading" message:@"\n\n" delegate:self cancelbuttontitle:@"" otherbuttontitles:@"ok", nil]; uiactivityindicatorview *loading = [[uiactivityindicatorview alloc] initwithactivityindicatorstyle:uiactivityindicatorviewstylegray]; loading.frame=cgrectmake(150, 150, 16, 16); [myalertview addsubview:loading];
i want in image uiactivity indicator
you can create custom alert follow (ps: had developed custom alert after 3 hours of working, compatible iphone4
, iphone5
, ipad
):
-(void)showalert{ alertviewview = [[uiview alloc]initwithframe:self.window.frame]; uiimageview *alertbackground = [[uiimageview alloc]initwithframe:cgrectmake(-200, -200, self.window.frame.size.width*2, self.window.frame.size.height*2)]; // alertbackground.image = [uiimage imagenamed:@"alertbackground.png"]; [alertviewview addsubview:alertbackground]; alertbackground.backgroundcolor = [uicolor blackcolor]; alertbackground.alpha = 0.5; uiimageview *alertimage = [[uiimageview alloc]initwithframe:cgrectmake(self.window.frame.size.width/2-310/2, self.window.frame.size.height/2-179/2, 310, 248)]; alertimage.image = [uiimage imagenamed:@"rommanalertbig.png"]; [alertviewview addsubview:alertimage];[alertbackground release];[alertimage release]; uibutton *lbutton = [uibutton buttonwithtype:uibuttontypecustom]; lbutton.frame = cgrectmake(self.view.frame.size.width/2-150+40-15, self.view.frame.size.height/2-179/2+118 , 120, 41); [lbutton settitle:@"cancel" forstate:uicontrolstatenormal]; [lbutton addtarget:self action:@selector(removealert) forcontrolevents:uicontroleventtouchupinside]; [alertviewview addsubview:lbutton]; uibutton *rbutton = [uibutton buttonwithtype:uibuttontypecustom]; rbutton.frame = cgrectmake(self.view.frame.size.width/2-150+170-15, self.view.frame.size.height/2-179/2+118 , 120, 41); [rbutton settitle:@"ok" forstate:uicontrolstatenormal]; [rbutton addtarget:self action:@selector(yesaction) forcontrolevents:uicontroleventtouchupinside]; [alertviewview addsubview:rbutton]; uilabel *lbl = [[uilabel alloc]initwithframe:cgrectmake(self.window.frame.size.width/2-310/2+30, self.window.frame.size.height/2-179/2+75, 260, 40+69)]; lbl.text = @"description"; lbl.textcolor = [uicolor whitecolor]; lbl.textalignment =uitextalignmentcenter; lbl.numberoflines = 0; lbl.font = [uifont systemfontofsize:17.0]; lbl.backgroundcolor = [uicolor clearcolor]; [alertviewview addsubview:lbl];[lbl release]; [self.window addsubview:alertviewview]; alertviewview.alpha = 0; [uiview animatewithduration:0.1 animations:^{alertviewview.alpha = 1.0;}]; alertviewview.layer.transform = catransform3dmakescale(0.5, 0.5, 1.0); cakeyframeanimation *bounceanimation = [cakeyframeanimation animationwithkeypath:@"transform.scale"]; bounceanimation.values = [nsarray arraywithobjects: [nsnumber numberwithfloat:0.5], [nsnumber numberwithfloat:1.1], [nsnumber numberwithfloat:0.8], [nsnumber numberwithfloat:1.0], nil]; bounceanimation.duration = 0.3; bounceanimation.removedoncompletion = no; [alertviewview.layer addanimation:bounceanimation forkey:@"bounce"]; alertviewview.layer.transform = catransform3didentity; } -(void)removealert{ (uiview *v in [alertviewview subviews]) { [v removefromsuperview]; } [alertviewview removefromsuperview]; [alertviewview release]; } -(void)yesaction { [self removealert]; // code here }
Comments
Post a Comment