ios - UIPickerView Only Responds Within Area of Tab Bar -
ios - UIPickerView Only Responds Within Area of Tab Bar -
i'm updating app ios 8 , trying recreate uipickerview
within uiactionsheet
uialertcontroller
described here. using reply nada gamal, able recreate functionality, uipickerview
responds within tab bar (even though tab bar hidden behind picker view). tab bar controller root view controller.
-(void)loadpickerview{ uipickerview *pickerview = [[uipickerview alloc] initwithframe:cgrectmake(0.0, 44.0, 0.0, 0.0)]; pickerview.showsselectionindicator = yes; pickerview.datasource = self; pickerview.delegate = self; pickerview.backgroundcolor = [uicolor whitecolor]; [pickerview selectrow:pickerviewrow incomponent:0 animated:no]; uitoolbar *pickertoolbar = [[uitoolbar alloc] initwithframe:cgrectmake(0, 0, self.view.frame.size.width, 44)]; pickertoolbar.tintcolor = self.navigationcontroller.navigationbar.tintcolor; nsmutablearray *baritems = [[nsmutablearray alloc] init]; uibarbuttonitem *flexspace = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:self action:nil]; [baritems addobject:flexspace]; uibarbuttonitem *donebtn = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemdone target:self action:@selector(dismissactionsheet)]; [baritems addobject:donebtn]; [pickertoolbar setitems:baritems animated:yes]; uialertcontroller * searchactionsheet=[uialertcontroller alertcontrollerwithtitle:@"" message:@"" preferredstyle:uialertcontrollerstyleactionsheet]; [ searchactionsheet.view setbounds:cgrectmake(8, 208, self.view.frame.size.width, pickerview.frame.size.height+pickertoolbar.frame.size.height)]; [searchactionsheet.view addsubview:pickertoolbar]; [searchactionsheet.view addsubview:pickerview]; [self presentviewcontroller:searchactionsheet animated:yes completion:nil]; }
the presentviewcontroller
in lastly line seems issue. i've tried many different ways pickerview respond outside tab bar area, including:
self
self.tabbarcontroller
self.navigationcontroller
(pickerview doesn't show @ all) [[uiapplication sharedapplication] keywindow].rootviewcontroller
the other alternative create separate view controller this, i'm concerned won't work either because uialertcontroller
subclass of uiviewcontroller
, perhaps issue adding subviews uialertcontroller
.
ios objective-c iphone ios8 uialertcontroller
Comments
Post a Comment