objective c - Picker On AlertView Not Visible in IOS7 -
my below code working fine in below ios 7 trying add picker view in alert works fine in below ios7 version in ios 7 show white alert without picker view.
-(void)showpinpickeralert { numberarr = [[nsmutablearray alloc]initwithobjects:@"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9", nil]; uialertview *alert =[[uialertview alloc]initwithtitle:@"enter pin change track me option" message:@"\n\n\n\n\n\n\n" delegate:self cancelbuttontitle:@"verify" otherbuttontitles:nil]; uipickerview *picker=[[uipickerview alloc]initwithframe:cgrectmake(25, 30, 230, 60) ]; picker.datasource=self; picker.delegate=self; // picker.backgroundcolor=[uicolor bluecolor]; picker.showsselectionindicator = yes; // picker.autoresizingmask = uiviewautoresizingflexibleheight; picker.transform = cgaffinetransformmakescale(0.6, 0.6); alert.tag=100; // picker.transform = cgaffinetransformmakescale(1, 0.2); [alert addsubview:picker]; [alert show]; } - (nsinteger)numberofcomponentsinpickerview:(uipickerview *)pickerview; { return 4; } - (void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component { strpin=[[nsstring stringwithformat:@"%i%i%i%i",[pickerview selectedrowincomponent:0],[pickerview selectedrowincomponent:1],[pickerview selectedrowincomponent:2],[pickerview selectedrowincomponent:3]]mutablecopy]; nslog(@"strpin=%@",strpin); // mlabel.text= [arrayno objectatindex:row]; } - (nsinteger)pickerview:(uipickerview *)pickerview numberofrowsincomponent:(nsinteger)component; { return [numberarr count]; } **//code try change color of picker text , background thats work fine in below ios7 in ios 7 still shows white screen** - (uiview *)pickerview:(uipickerview *)pickerview viewforrow:(nsinteger)row forcomponent:(nsinteger)component reusingview:(uiview *)view { uilabel *label = (uilabel*) view; if (label == nil) { label = [[uilabel alloc] init]; } //[label settext:@"whatever"]; // part colorizes everything, since asked that. [label settextcolor:[uicolor whitecolor]]; [label setbackgroundcolor:[uicolor blackcolor]]; cgsize rowsize = [pickerview rowsizeforcomponent:component]; cgrect labelrect = cgrectmake (0, 0, rowsize.width, rowsize.height); [label setframe:labelrect]; return label; } - (nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component; { pickerview.backgroundcolor=[uicolor blackcolor]; return [numberarr objectatindex:row]; }
output in below
output in ios 7
how fix it?
adding subviews uialertview
not supported anymore, starting in ios7.
you should implement own view , try similar alert view, or other person said, use 3rd party alert view one:
Comments
Post a Comment