Reputation: 23550
I have a UIImagePickerController, and while it's loading, I want to display a disclaimer in a modalView.
- (void) viewDidLoad
{
self.picker = [[UIImagePickerController alloc] init];
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
self.picker.delegate = self;
[self presentModalViewController:self.picker animated:NO];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
DisclaimerController* disclaimer = [[DisclaimerController alloc] init]; // Loads the Xib inside the init method
UINavigationController* controller = [[UINavigationController alloc] initWithRootViewController:disclaimer];
[self.navigationController presentModalViewController:controller animated:YES];
}
But it doesn't shows up.
And I don't want to dismiss the picker while the disclaimer is showing or show it later, because there are some treatments that takes some time and the time the user reads the disclaimer would prevent him to wait too long after closing the disclaimer.
Upvotes: 0
Views: 491
Reputation: 3647
I would solve it using an AlertView.
But if you prefer using your method maybe this will do the trick
Try this:
- (void) showModalDisclaimer {
DisclaimerController* disclaimer = [[DisclaimerController alloc] init];
// Loads the Xib inside the init method
UINavigationController* controller = [[UINavigationController alloc]
initWithRootViewController:disclaimer];
[self.picker presentModalViewController:controller animated:YES];
// notice self.picker
}
- (void) viewDidLoad
{
self.picker = [[UIImagePickerController alloc] init];
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
self.picker.delegate = self;
[self presentModalViewController:self.picker animated:NO];
[[UIApplication sharedApplication] setStatusBarHidden:NO
withAnimation:UIStatusBarAnimationNone];
[self performSelector:@selector(showModalDisclaimer) withObject:nil afterDelay:0.1];
}
Upvotes: 1