ios - Is there any way to encapsulate UIAlertController within another UIViewController? -


i'm new ios, please keep answers clear. i've been toying encapsulating uialertcontroller in uiviewcontroller use replacement uiactionsheet it's deprecated in ios 8.

the idea replacement uiactionsheet backward , forward compatible, , call immortalactionsheet instance.

if component used in ios 8 or greater, can use uialertcontroller, otherwise fall uiactionsheet. make backward , forward compatible action sheet replace many action sheets around application i'm working with. , yes need maintain backward compatibility.

i've prototyped whatever reason, when present immortalactionsheet, uialertcontroller view show @ top left (0, 0). no matter if change center, never moves.

-(void) loadview {      uiview * child = nil;      if ( [uialertcontroller class] )      {          uialertcontroller * alertcontroller = [uialertcontroller alertcontrollerwithtitle:@"make choice!!" message:@"choose one!" preferredstyle:uialertcontrollerstyleactionsheet];          (uialertaction * action in actions ){              [alertcontroller addaction:action];          }           child = alertcontroller.view;          [self addchildviewcontroller:alertcontroller];      }       self.view = [[uiview alloc] init];      self.view.backgroundcolor = [uicolor clearcolor];      [self.view addsubview:child]; } 

enter image description here


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -