0

在我的 ipad 应用程序中,我无法在 Web 视图中获取数据。该 Web 视图位于 splitviewcontroller 的详细视图中。该数据来自链接。

我正在使用这段代码。

在拆分视图表中确实选择了索引路径处的行

post=[self.postListMutableArray objectAtIndex:indexPath.row];
PostDetailsViewController *postDetails=[[PostDetailsViewController alloc]initWithNibName:@"PostDetailViewController_Ipad" bundle:nil];
postDetails.detailItem=post.postLink;

在拆分视图详细视图中

- (void)setDetailItem:(id)newDetailItem
{
if (_detailItem != newDetailItem)
{
    _detailItem = newDetailItem;

    // Update the view.

    NSLog(@"detail Item String is %@",_detailItem);

    [self configureView];



}

}



- (void)configureView
{
// Update the user interface for the detail item.


    NSString* str =_detailItem;
    NSURL* url = [NSURL URLWithString:str];
    NSLog(@"URL is ----> %@",url);
    self.webView.scalesPageToFit=YES;
    [self.webView loadRequest:[NSURLRequest requestWithURL:url]];
    //[self.view addSubview:webView];

    }
4

1 回答 1

0

PostDetailsViewController在.h 类中创建新变量:-

@property(strong,nonatomic)NSString *strGetPostDetail;

并合成PostDetailsViewController.m

@synthesize strGetPostDetail

现在您可以调用splitViewTable Delegate DidSelect方法:-

post=[self.postListMutableArray objectAtIndex:indexPath.row];
PostDetailsViewController *postDetails=[[PostDetailsViewController alloc]init];
postDetails.strGetPostDetail=post;
于 2013-01-10T07:33:44.477 回答