2013-05-02 114 views
1

我看過所以不能找到答案。我從呈現模式的看法:模態視圖模態視圖不顯示

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    [tableView deselectRowAtIndexPath:indexPath animated:YES]; 
    ICObservationEditController *controller = [[ICObservationEditController alloc] initWithObservation:[self.observations objectAtIndex:indexPath.row]]; 
    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller]; 
    navController.navigationBar.barStyle = UIBarStyleBlackOpaque; 
    navController.navigationBar.tintColor = [UIColor grayColor]; 
    [self.editController presentModalViewController:navController animated:YES]; 
} 

一旦提出,作爲一個選項,我想在上面從MessageUI框架提出了一條短信:

MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init]; 
if([MFMessageComposeViewController canSendText]) { 
    NSLog(@"presented"); 

    //code here for text body 

    controller.recipients = [NSArray arrayWithObjects:@"", nil]; 
    controller.messageComposeDelegate = self; 
    [self.editController presentModalViewController:controller animated:YES]; 
} 

調試器證實了我接收事件,但未提供視圖。代碼是正確的,因爲我已經在其他應用程序中使用完全相同的代碼,但尚未在模態視圖中使用。

+0

從已經以模態方式呈現的視圖呈現模態視圖不是一種好的做法。 http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html – satheeshwaran 2013-05-02 17:46:32

回答

0

UIKit不會允許這樣做,但有解決方法。這article應該可以幫到你。