开发者

Modal view not displaying properly

I am writing an iPad app and want to put an option on the home screen (root view controller) to allow users to e-mail feedback. I would like the mail to appear with the style "UIModalPresentationFormSheet". 开发者_如何学CHowever, when I run the code, it appears full screen. What am I doing wrong? Here is the code I am using:

    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;
    NSArray *toAddresses = [[NSArray alloc] initWithObjects:@"user@domain.com", nil];
    [picker setToRecipients:toAddresses];
    [toAddresses release];              
    [picker setSubject:@"App Feedback"];
    self.modalPresentationStyle = UIModalPresentationFormSheet;
    [self presentModalViewController:picker animated:YES];
    [picker release];


You must set the style of the viewController being presented, not on the one presenting it.. So set the property of the MFMailComposeViewController and you should be ok.


You need to set modalPresentationStyle on your new view controller, not self.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜