我正在尝试创建一个弹出窗口,当我呈现视图控制器时,背景总是纯黑色,大小是全屏.
我似乎无法弄清楚什么是错的,这是我的代码
@IBAction func distancePopOver( sender : UIBarButtonItem){ //a UIViewController that I created in the storyboard let controller = storyboard!.instantiateViewControllerWithIdentifier("distancePopOver") controller.modalPresentationStyle= UIModalPresentationSTyle.PopOver controller.preferredContentSize = CGSizeMake(200,30) self.presentViewController(controller, animated: true, completion: nil) //Configure the Popover presentation controller let popController = (controller.popoverPresentationController)! popController.permittedArrowDirections = UIPopoverArrowDirection.Down popController.barButtonItem = sender popController.delegate = self }
每当我点击UIBarButtonItem时,它都会以全屏显示视图,但它不应该是我在第5行中指定的大小吗?