开发者

How to make a class in one file work with UIWebViewController implemented in another file?

So I have a UIWebView implemented in one .m file and a UITableView implemented in another. When a user clicks UITableView element, the UIWebView appears. The problem is that I have to set UIWebView's content (local text and images) depending on the UITableView's row number. I know how to do this, but this, of course must be implemented 开发者_StackOverflow社区with the UITableView but it also needs UIWebView.

Just importing the UIWebView implementation does'n work.

Thanks in advance!


see this link to for setting delegates here

In didSelectRowAtIndexpath

 NSString *name=@"content of table";
 myAppDelegate *appDelegate = (myAppDelegate *) [[UIApplication sharedApplication] delegate];
    [appDelegate setCurrentTitle:name]; 

PictureWebViewController *webview = [[PictureWebViewController alloc] initWithNibName:@"PictureWebViewController" bundle:nil];


[self.navigationController pushViewController:email animated:YES];

the PictureWebViewController is class of your webview .

In that class in viewdidload method get the title as

  myAppDelegate *appDelegate = (myAppDelegate *) [[UIApplication sharedApplication] delegate];
  NSString *name= [appDelegate getCurrentTitle];

Use the name in this class to display the content in webview.

All the Best

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜