当选择 RootView 中的一行时,如何使 UISplitView 的详细信息视图中的 UIWebView 更改其内容?

发布于 2024-08-30 20:37:37 字数 662 浏览 3 评论 0原文

我有一个基于 UISplitView 的应用程序,在详细信息视图中有一个 UIWebVIew 。当用户在根视图中的表中选择新行时,我想让它更改其内容。我在 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];
}   
}
}

请帮助我! 提前致谢!

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 advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷…雨湿花 2024-09-06 20:37:37

请参阅以下网站上第 3 章中的视频:http://www.lynda。 com/home/DisplayCourse.aspx?lpk2=65722

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

于我来说 2024-09-06 20:37:37

您需要对视图控制器的引用,其中包含根视图控制器中的网络视图(您的详细视图控制器)。当选择一行时,调用 webview(详细信息)控制器中的方法并向其传递文件名、URL 等......然后它依次调用 uiwebview 方法来加载请求。 loadRequest:loadHTMLString:
此处的文档

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文