小编Sur*_*nde的帖子

popoverpresentviewcontroller与矩形角和没有箭头

我想要一个没有圆角但没有箭头的弹出窗口.

我已经完成了以下代码,但它不起作用:

//SerachPopViewController.swift

    //MARK: InitCoder
required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    //popover settings
    //popoverPresentationController!.permittedArrowDirections = .Any
    modalPresentationStyle = .Popover
    popoverPresentationController!.delegate = self
    //permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0)
    self.preferredContentSize = CGSize(width:340,height:380)
}
Run Code Online (Sandbox Code Playgroud)

//QueryTableViewController.swift

    @IBAction func searchFilter(sender: AnyObject) {

    let searchPopController = storyboard!.instantiateViewControllerWithIdentifier("SerachPopViewController") as! SerachPopViewController
    searchPopController.serachPopDelegate = self
    searchPopController.modalPresentationStyle = .Popover
    searchPopController.preferredContentSize = CGSize(width:340,height:380)

    let popoverPresentationController = searchPopController.popoverPresentationController

    popoverPresentationController!.sourceView = self.view;
    popoverPresentationController!.sourceRect = CGRectMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds),0,0)
    popoverPresentationController!.permittedArrowDirections = UIPopoverArrowDirection();
    self.presentViewController(searchPopController, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)

我可以用箭头和圆形箭头显示弹出窗口视图.

请帮我实现:

  • 弹出视图与矩形角
  • 没有方向箭头的弹出视图

iphone uipopovercontroller ios swift

7
推荐指数
3
解决办法
6656
查看次数

标签 统计

ios ×1

iphone ×1

swift ×1

uipopovercontroller ×1