开发者

Why my presentModalViewController method doesn't work

I created a UIImagePickerController in the viewDidLoad method in my rootViewController.

- (void)viewDidLoad {
    [super viewDidLoad];

    UIImagePickerController *pickerController=[[UIImagePickerController alloc] init];
    pickerController.sourceType=UIImagePickerControllerSourceTypeSavedPhotosAlbum;
    pickerController.delegate=self;

    [self presentModalViewController:pickerController animated:YES];
    [pickerController release];
}

But the view of UIImagePickerViewController didn't开发者_开发问答 appear on the screen.

The SDK version is 4.3

Is there some mistakes i make?

Thanks!


viewDidLoad is called after the view has been loaded and before the view is displayed. viewDidAppear: is called when the view is onscreen and is the correct point to present a modal view controller.

And if you want to do it only once, you might want to consider using a BOOL to keep track of it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜