开发者

How to make UIWebView in the Detail View of a UISplitView change its content when a row in RootView is selected?

开发者 https://www.devze.com 2022-12-28 21:38 出处:网络
I have a UISplitView-based app with a UIWebVIew in the Detail View. I want to make it change its content when user chooses a new row in the table in Root View. I tried like this in DetailViewControlle

I have a UISplitView-based app with a UIWebVIew in the Detail View. I want to make it change its content when user chooses a new row in the table in Root View. I tried like this in DetailViewController:

- (void)setDetailItem:(id)newDetailItem {
extern NSString *rowname;
if (detailItem != newDetailItem) {
    [detailItem release];
    detailItem = [newDetailItem retain];        
    // Update the view.
if ([rowname isEqualToString:@"About"])
 [self loadFile:@"About.rtf"];
if ([rowname isEqualToString:@"Square"])
 [self loadFile:@"Square.rtf"];
//And so on with every UITableView element from the RootView
if (popoverController != nil) {
    [popoverController dismissPopoverAnimated:YES];
}   
}
}

Help me, please! Thanks in a开发者_如何学运维dvance!


See the videos in chapter 3 on this website: http://www.lynda.com/home/DisplayCourse.aspx?lpk2=65722


You need a reference to the viewcontroller which contains the webview (your detail view controller) within your rootview controller. when a row is selected, call a method in the webview (detail) controller and pass it a filename, URL, whatever... and it in turn calls the uiwebview method to load the request. Either loadRequest: or loadHTMLString: docs here

0

精彩评论

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