2016-07-12 22 views
6

Tôi đang cố gắng trình bày một UIViewController trong một UIPopoverPresentationController nhưng tôi không thực sự thích tính năng mũi tên.UIPopoverPresentation mà không cần mũi tên

Về cơ bản những gì tôi muốn làm là sử dụng UIPopoverPresentationController without the arrow đi kèm với nó.

Tôi đang mã hóa bằng Swift.

+0

Theo như tôi biết bạn không thể sử dụng UIPopoverPresentationController mà không có mũi tên. Cách duy nhất - sử dụng/tạo lớp khác. –

+0

Bạn có thể cho tôi biết nơi/tìm kiếm gì sau đó không? – meteorSD

+2

Không, tôi không thể, tôi thích mũi tên đó, xin lỗi: D –

Trả lời

13

Đây là những gì tôi đã giải quyết chỉ vài ngày trở lại. Những gì tôi đã làm về cơ bản là loại bỏ mũi tên và cung cấp một nguồn trực tiếp bản thân mình. Nguồn của khóa học đã thay đổi vị trí Y của nó để cung cấp cho nó một hiệu ứng popover mà không có mũi tên. Hãy thử nó, làm việc như một sự quyến rũ đối với tôi.

yourPopoverPresentationController!.permittedArrowDirections = UIPopoverArrowDirection.init(rawValue: 0) 
let aView = //Source View that you would provide for the source rect 
yourPopoverPresentationController!.sourceView = aView 
let position = CGRectMake(aView.bounds.origin.x, aView.bounds.origin.y + 125, aView.bounds.size.width, aView.bounds.size.height) 
yourPopoverPresentationController!.sourceRect = position 

Điều này dẫn đến hiệu ứng sau đây là những gì tôi yêu cầu. enter image description here

Các vấn đề liên quan