相关疑难解决方法(0)

在WkWebView iOS中选择图像时,模态视图关闭

我正在构建一个包含WkWebView的弹出模式视图的应用程序.当我想在此模态视图中上传图像并且出现"照片选择"时,模态视图只会将其解除回发射它的视图控制器.

我怎么能防止这种情况?

import UIKit

class PostWindow : UIViewController {

@IBAction func close(sender: AnyObject) {
    dismissViewControllerAnimated(true, completion: nil)
}

override func viewDidLoad() {
    super.viewDidLoad()
    // do stuff here
    let myWebView:UIWebView = UIWebView(frame: CGRectMake(0, 70, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height))
    myWebView.loadRequest(NSURLRequest(URL: NSURL(string: "https://m.facebook.com/")!))
    self.view.addSubview(myWebView)

    self.title = "News Feed"

    UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.Default, animated: true)
    UIApplication.sharedApplication().statusBarHidden = false

    /*let addButton: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Search,
    target: self,
    action: #selector(self.openSearch(_:)))
    self.navigationItem.setRightBarButtonItems([addButton], animated: true)*/
    self.navigationController?.navigationBar.tintColor = UIColor.blackColor()
}

override func preferredStatusBarStyle() -> UIStatusBarStyle {
    return UIStatusBarStyle.LightContent
}
Run Code Online (Sandbox Code Playgroud)

}

谢谢!

viewcontroller modal-view swift

7
推荐指数
1
解决办法
2658
查看次数

标签 统计

modal-view ×1

swift ×1

viewcontroller ×1