开发者

Communication between a UIWebView and UINavigationController?

开发者 https://www.devze.com 2023-03-09 03:15 出处:网络
I have a app where users can connect with numerous websites. I have a UINavigationController that displays all the websites. It will push when the user taps on into a webView in a different view contr

I have a app where users can connect with numerous websites. I have a UINavigationController that displays all the websites. It will push when the user taps on into a webView in a different view controller.

This all is fine, but when the user is done, how can the UIViewController communicate with the app and tell it to pop back one? I have compete control of the php files in the webView, so it should be easy, right?

I was thinking about getting the title from t开发者_StackOverflow中文版he javascript file every time it loads. If it's a special, then go back? What would be the best way in doing this?

I haven't been able to find anything on the internet. If you could just point me in the right direction, that would be fantastic!

Thanks, Coulton


I'm unsure what you mean by "when the user is done" - do you mean when the user has finished viewing the selected webpage and wants to go back to the list?

If so, you already will have pushed your UIViewController on to the UINavigationController which is not much more than a stack of UIViewController instances. Every UIViewController has a navigationController property which is nil until the view controller is pushed onto a navigation controller.

With that in mind, try calling:

[self.navigationController popViewControllerAnimated:yesOrNo]

where self should be the view controller you want to pop.

0

精彩评论

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