Ios 选择RowatineXpath时打开新视图
在我的主要观点中,我有一个UITableView。当用户点击单元格时,我想打开一个新视图,这是我目前拥有的:Ios 选择RowatineXpath时打开新视图,ios,uitableview,uiwebview,uiviewcontroller,modalviewcontroller,Ios,Uitableview,Uiwebview,Uiviewcontroller,Modalviewcontroller,在我的主要观点中,我有一个UITableView。当用户点击单元格时,我想打开一个新视图,这是我目前拥有的: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { WebViewController *web = [[WebViewController alloc] initWithNibName:@"WebViewController" bundle:nil
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
WebViewController *web = [[WebViewController alloc] initWithNibName:@"WebViewController" bundle:nil];
web.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:web animated:YES];
[web release];
}
问题是,web视图在表视图中打开。该表非常小(320x160px),因此新的web视图仅在此框架内打开。我需要它完全/全屏打开
我猜问题与这一行有关:
[self presentModalViewController:web animated:YES];
有什么想法吗?您不仅应该展示
UIWebView
,还应该展示一个包含UIWebView
的UIViewController
。根据所描述的行为,我猜测NIB只包含UIWebView
通常,视图控制器子类将包括一个导航栏或工具栏,以便可以取消视图
有几种方法,但有一种是将
UIViewController
添加到NIB,然后拖动UIWebView
,连接插座等,然后代码将按原样工作。这是一个UIViewController,我只是将其命名为WebViewController。您的类名与控制器一致,这很好。怀疑你的笔尖结构有问题;你需要发布更多关于这方面的信息。谢谢彼得,我尝试了一种不同的方法,效果很好。我决定使用NSNotificationCenter作为两者之间的沟通方式。