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

.h クラスに新しい変数を作成しますPostDetailsViewController:-

@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 に答える