1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- //
- // BrowserViewController.m
- // WildFireChat
- //
- // Created by heavyrain.lee on 2018/5/15.
- // Copyright © 2018 WildFireChat. All rights reserved.
- //
- #import <WebKit/WebKit.h>
- #import "WFCUBrowserViewController.h"
- @interface WFCUBrowserViewController ()
- @property (nonatomic, strong)WKWebView *webView;
- @end
- @implementation WFCUBrowserViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- self.webView = [[WKWebView alloc] initWithFrame:self.view.bounds];
- [self.view addSubview:self.webView];
- [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.url]]];
- self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"..." style:UIBarButtonItemStyleDone target:self action:@selector(onRightBtn:)];
- }
- - (void)onRightBtn:(id)sender {
- UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"浏览器打开" otherButtonTitles:nil, nil];
- [actionSheet showInView:self.view];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- #pragma mark - UIActionSheetDelegate <NSObject>
- - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
- if(buttonIndex == 0) {
- [[UIApplication sharedApplication] openURL:[[NSURL alloc] initWithString:self.url]];
- [self.navigationController popViewControllerAnimated:NO];
- }
- }
- @end
|