I can not access UIImagePickerController defined in AppDelegate.I already defined UIImagePickerController object in AppDelegate.h file also used its delegate. This is my code.
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.wantsFullScreenLayout = YES;
picker.allowsEditing=NO;
return YES;
}
And I am using action sheet in viewcontroller file and want to perform this action as –
viewController.m
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch (actionSheet.tag)
{
case 1:
switch (buttonIndex)
{
case 0:
{
AppDelegate *appDelegate = (AppDelegate*) [[UIApplication sharedApplication] delegate];
[appDelegate.window.rootViewController presentModalViewController:appDelegate.picker animated:YES];
}
}
}
}
But image picker controller view is not showing.
in your
don’t write
instead try to write
Let me know it is working or not.!!!
Happy Coding!!!!!