English 中文(简体)
UIViewControllers and UIWebView
原标题:UIViewControllers and UIWebView
  • 时间:2009-08-30 09:34:18
  •  标签:

我是个新手,是一个问题,最终可能有助于理解这一概念。

基本上,我有“情报总会”,它装着一只 st子。 现在我想,当一个用户点击ton子时,要拿出一种不同的观点,而这种看法可能是一种网上意见。 现在,我想我们的看法是,视原观点所批评的纽伦而定,要装上不同的气温。

如何做到这一点? 基本上,在我头脑中,我认为,在纽伦受到压力时,我可以装上并淡化看法。

In

- (void)tableView:(UITableView *)tableView 
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    NSString *selectedLink = [valuesForSection objectAtIndex:row];

    NSString *urlAddress = @"http://www.google.com";

    //Create a URL object.
    NSURL *url = [NSURL URLWithString:urlAddress];

    //URL Requst Object
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

    //Load the request in the UIWebView.
    [webView loadRequest:requestObj];

    [self.view removeFromSuperview];
    [self.view insertSubview:webView atIndex:0];
}

这样做是否正确? 或者,如何做到这一点?

问题回答

这将是我所走的,是的。 创建单一电离层电离层电离层电离层电离层电离层电离层电离层电离层。 它的好处是,不要求你为每个单位建立单独的网络看法,也不要求你做到同步。

但是,我一定要删除<代码>。 每当一个囚室被点击时,从表面上看,我就跑过一个模式观点控制器(present ModalViewController:animated:)。 根据网络观点,或我把新的控制器推向导航控制器组(pushViewController:animated:)。 它推动更顺利的过渡,并将更好地面向用户。

<<>Edit>/strong>(针对评论): 是的,拥有另一个控制器比只是交换看法更好。 Doing removeFrom Superview and addSubview: 这两种观点都保留在同一控制器内,但结果将使你的代码更难管理(一名控制员将处理两种观点),而且用户经验更差(如没有过渡,就像在导航控制员的推动下建立)。

为了适当推进,你应当:

  • Build a navigation controller for your existing view controller
  • When you need to, create a new instance of UIViewController with its view set to the UIWebView you create and load with your HTML
  • Push the new view controller onto the navigation controller stack from your old view controller by calling:
[self.navigationController pushViewController:newViewController animated:YES];




相关问题
热门标签