开发者

how to open an in app browser like the mailcomposion popup

is it possible to open an in-app browser that loads a pdf and the takes you back to the nib just like the mailcomposition does with the in-app email?开发者_如何学Python If so, can anyone please help.


You should be able to use a UIWebView controlled by a custom UIViewController, which you present using the presentModalViewController:animated: method in the view controller that wants to pop up the PDF.


1) Create a .xib and corresponding view controller (both named WebViewViewController here). This should include a UIWebView (to display the PDF) and a UIButton (to close the modal view & return to your original view).

2) Present your WebViewViewController as a modal view. This will "pop-over" your current view with the new view.

WebViewViewController *webViewVC = [[WebViewViewController alloc] initWithNibName:@"WebViewViewController" bundle:nil];

//I am showing it over a Navigation Controller, you may be using something different.
[self.navigationController presentModalViewController:webViewVC animated:YES];

[webViewVC release];

3) In your WebViewViewController, wire up an IBAction method to your "Close" button. In that method use this to dismiss the "pop-over" view.

//
[self dismissModalViewControllerAnimated:YES];
  • Let me know if you need help with loading the PDF into the UIWebView.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜