This code is written in subclass of UIViewController and "self" is UIViewController.
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIImagePickerController *controller = [[UIImagePickerController alloc] init];
controller.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:controller animated:NO];
[controller release];
}
At -viewDidAppear:, that works properly.
For example, in AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//insert initialize code here, not work
[window addSubview:viewController.view];
[window makeKeyAndVisible];
//insert initialize code here, work
return YES;
}
spec iPhone 3GS OS 3.1.3
No comments:
Post a Comment