Tôi muốn luôn hiển thị ViewController
trong cửa sổ bật lên trên tất cả các thiết bị và mọi hướng. Tôi đã cố gắng thực hiện điều này bằng cách áp dụng UIPopoverPresentationControllerDelegate
và đặt sourceView
và sourceRect
.UIModalPresentationPopover for iPhone 6 Plus in landscape không hiển thị cửa sổ bật lên
Tính năng này hoạt động rất tốt cho tất cả các thiết bị và định hướng, ngoại trừ iPhone 6 Plus ở chế độ ngang. Trong trường hợp đó, trình điều khiển chế độ xem sẽ trượt lên từ cuối màn hình trong một biểu mẫu. Làm thế nào tôi có thể ngăn chặn điều đó để nó sẽ luôn xuất hiện trong một cửa sổ bật lên?
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let popoverPresentationController = segue.destinationViewController.popoverPresentationController
popoverPresentationController?.delegate = self
popoverPresentationController?.sourceView = self.titleLabel!.superview
popoverPresentationController?.sourceRect = self.titleLabel!.frame }
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
return UIModalPresentationStyle.None }
Tất cả các thiết bị đang bị iOS 8.2 hoặc cao hơn
Cuộc gọi tốt! Tôi quên rằng phương thức ủy nhiệm đã thay đổi cho 8.3. –
@PetahChristian Cảm ơn! Vâng là một thay đổi khá yên tĩnh và dường như không được ghi chép khác ngoài các khác biệt về API. – Joshua
@Joshua YES! Tôi đã thực hiện - (UIModalPresentationStyle) adaptivePresentationStyleForPresentationController: (UIPresentationController *) controller { trả về UIModalPresentationNone; } nhưng API mới giải quyết được vấn đề của tôi, cảm ơn bạn! – Loegic