以编程方式创建一个 Web 视图和一个返回上一个视图的按钮
我希望有一个关于如何创建网络视图并设置返回按钮以便用户可以返回上一个视图的概念。 我有一个转到详细视图的表视图,在详细视图上我有一个连接了 url 链接的按钮。现在,当选择此按钮时,它应该打开一个 Web 视图(应该是另一个 .xib 文件吗?),在 Web 视图上我需要一个带有返回按钮的工具栏,该按钮将返回详细视图
我需要知道如何执行此操作
谢谢全部
编辑 我有
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
aBook = [delegate.books objectAtIndex:indexPath.row];
// Configure the cell.
titleValue = aBook.title;
authorValue = aBook.author;
urlValue = aBook.bookUrl;
detailViewController = [[DetailView alloc] initWithNibName:@"DetailView" bundle:nil];
detailViewController.title = titleValue;
detailViewController.author = aBook.author;
detailViewController.bookUrl = aBook.bookUrl;
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
详细视图的设置值,所以我应该有相同的值来将 url 发送到 Web 视图吗?
i would appreciate a concept on How can i create a web view and set a return button so the user can return on the previous view.
I have a table view that goes to a detail view, and on the detail view i have a button that has a url link connected. Now when this button is selected it should open a web view (should it be another .xib file?) and on the web view i need a toolbar with return button that will return the detail view
i need idea on how can i do this
Thanks all
-edit
i have the
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
aBook = [delegate.books objectAtIndex:indexPath.row];
// Configure the cell.
titleValue = aBook.title;
authorValue = aBook.author;
urlValue = aBook.bookUrl;
detailViewController = [[DetailView alloc] initWithNibName:@"DetailView" bundle:nil];
detailViewController.title = titleValue;
detailViewController.author = aBook.author;
detailViewController.bookUrl = aBook.bookUrl;
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
this sets values for the detail view, so should i have the same to send the url to the web view??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然,一种选择是您可以在thirdViewController 中使用您的webview 和工具栏创建一个新的xib,并将url 传递给viewController。通过触摸后退按钮,您可以关闭第三个视图控制器,并且您拥有详细视图控制器。
或者
如果您确实不想拥有 viewController,您可以创建自定义视图设计并以编程方式放置控件。然后将自定义视图的子视图添加到您的详细视图中。创建委托来处理自定义视图操作,以便在触摸后退按钮时从详细视图中删除自定义视图。
如果您有疑问请告诉我
One option is of-course you can create a new xib with your webviews and Toolbars in thirdViewController and pass the url to the viewController. by touching back button you can dismiss your thirdViewController and you have the detailViewController.
or
If you really dont want to have a viewController you can create your customView design and place the controls programmatically. Then add subview the customView to your detailView. Create delegates to handle the customView Actions so that remove your customview from your detailView when back button is touched.
let me know if you have doubts