ios - Issue making method run at application launch -


I am working on developing an app which uses the camera for different purposes just now, when I apply Launch I am struggling to get a tidbit of code to run:

  UIImagePickerController * imageView = [[UIImagePickerController alloc] init]; ImageView.delegate = self; ImageView.sourceType = UIImagePickerControllerSourceTypeCamera; ImageView.showsCameraControls = No; [Self present ViewController: animated imageView: yes complete: zero];   

I need to execute on the imageView UIView object on the launch, when this application is opened, it goes directly to UIImagePickerController is. Here's my code for the app:

  - (zero) viewDidoadload {[Super stuffed]; // Setup an additional after loading the view, usually from any nib } - (zero) did risive memorianising [[super dysrhymmy warning]; // Any resource settlement which can be reproduced. } - (zero) Application FeedbackActive {UIImagePickerController * imageView = [[UIImagePickerController alloc] init]; ImageView.delegate = self; ImageView.sourceType = UIImagePickerControllerSourceTypeCamera; ImageView.showsCameraControls = No; [Self-present ViewController: animated imageView: yes complete: zero]; } @ And    

If you want to notify in any controller, listen to you UIApplicationDidBecomeActiveNotification or. - (zero) viewDidoadload {[Super Viewedload]; [[NSNotificationCenter defaultCenter] addObserver: Self selector: @selector (applicationDidBecomeActive) Name: UIApplicationDidBecomeActiveNotification Object: Zero]; }

To unregister,

  remove [[NSNotificationCenter defaultCenter]; observer: Own name: UIApplicationDidBecomeActiveNotification object: zero];   

in dealloc or whenever you do not want to receive notifications.


If you use storyboards, then your app representative should be

  @implementation AppDelegate - (BOOL) Application: (UIApplication *) Application FinishLaunchingWithOptions: (NSDictionary *) launchOptions {// Override point for optimization after application launch return yes; } If you do not use the storyboard, then your app may be representative  
  @implementation AppDelegate - (BOOL) Application: (UIAPCirmation *) Application was Finished Launching Request: (NSDrment *) Launch option {self.windows = [[UI window light] Intewithframe: [[USScreen main screen] Bound]]; [Self. Windows and knowledgeable]; Self.window.rootViewController = [[ViewController alloc] init]; Yes come back } // รข ?? | @end   

and your view controller

  @implementation ViewController - (zero) viewDidoadload {[Super Viewedload]; [[NSNotificationCenter defaultCenter] addObserver: Self selector: @selector (applicationDidBecomeActive) Name: UIApplicationDidBecomeActiveNotification Object: Zero]; } - (Zero) Delok {{NSNotificationCenter defaultCenter] to remove observer: Own name: UIApplicationDidBecomeActiveNotification object: zero]; } - (zero) Application FeedbackActive {UIImagePickerController * imageViewPickerController = [[UIImagePickerController alloc] init]; ImageViewPickerController.sourceType = UIImagePickerControllerSourceTypeCamera; [Self present ViewController: animated imageViewPickerController: not completed: NULL]; } @end    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -