Saturday, 15 January 2011

iphone - Add UIPickerView in UIActionSheet from IOS 8 not working -



iphone - Add UIPickerView in UIActionSheet from IOS 8 not working -

i adding uipickerview uiactionsheet working perfectally in ios 7 not working in ios 8. please help me solve that.

here attached screenshot that.

thanks

i using next code that.

uiactionsheet *actionsheet; nsstring *pickertype; - (void)createactionsheet { if (actionsheet == nil) { // setup actionsheet contain uipicker actionsheet = [[uiactionsheet alloc] initwithtitle:@"please select" delegate:self cancelbuttontitle:nil destructivebuttontitle:nil otherbuttontitles:nil]; actionsheet.backgroundcolor = [uicolor clearcolor]; uitoolbar *pickertoolbar = [[uitoolbar alloc] initwithframe:cgrectmake(0, 0, 320, 40)]; pickertoolbar.barstyle = uibarstyleblackopaque; [pickertoolbar sizetofit]; uiimageview *imageobj = [[uiimageview alloc]initwithframe:cgrectmake(0, 0, 320, 40)]; imageobj.image = [uiimage imagenamed:@"header.png"]; [pickertoolbar addsubview:imageobj]; uibutton *cancelbtn = [uibutton buttonwithtype:uibuttontypecustom]; [cancelbtn addtarget:self action:@selector(pickercancel:)forcontrolevents:uicontroleventtouchdown]; // [cancelbtn setimage:[uiimage imagenamed:@"btninvitecancel.png"] forstate:uicontrolstatenormal]; [cancelbtn settitle:@"cancel" forstate:uicontrolstatenormal]; cancelbtn.frame = cgrectmake(7.0, 7.0, 65.0, 25.0); [pickertoolbar addsubview:cancelbtn]; uibutton *donebtn = [uibutton buttonwithtype:uibuttontypecustom]; [donebtn addtarget:self action:@selector(pickerdone:)forcontrolevents:uicontroleventtouchdown]; //[donebtn setimage:[uiimage imagenamed:@"btninvitedone.png"] forstate:uicontrolstatenormal]; [donebtn settitle:@"done" forstate:uicontrolstatenormal]; donebtn.frame = cgrectmake(258.0, 7.0, 55.0, 25.0); [pickertoolbar addsubview:donebtn]; [actionsheet addsubview:pickertoolbar]; [pickertoolbar release]; uipickerview *chpicker = [[uipickerview alloc] initwithframe:cgrectmake(0.0, 0.0, 320.0, 200.0)]; chpicker.datasource = self; chpicker.delegate = self; chpicker.showsselectionindicator = yes; [chpicker selectrow:0 incomponent:0 animated:yes]; [actionsheet addsubview:chpicker]; [chpicker release]; [actionsheet showinview:self.view]; [actionsheet setbounds:cgrectmake(0,0,320, 464)]; } }

it doesn't work because apple changed internal implementation of uiactionsheet. please refer the documentation:

subclassing notes

uiactionsheet not designed subclassed, nor should add together views hierarchy. if need nowadays sheet more customization provided uiactionsheet api, can create own , nowadays modally presentviewcontroller:animated:completion:.

ios iphone uipickerview uiactionsheet ios8

No comments:

Post a Comment