My goal is to keep same coordinates for a UIPopoverController with just changing arrow offset. So basically i have three buttons touching each of them shows up a popover. When presenting this popover it changes position on the screen, but i do not want that. To be more clear look at screenoshots:
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
- How can I add media attachments to my push notific
You can't do it as-is with Apple's built-in UIPopoverViewController class. But it should be fairly simple and logical to implement your own popover view controller (just some very basic 2D geometry and a bit of digging in UIView's docs).
For my popover I wanted the arrow to be top-left instead of top-center (which is default).
I've managed to get the result below (screenshot) by setting the
popoverLayoutMargins
property of the UIPopoverController. You can use it to reduce the screen-area used in the internal calculations of the UIPopoverController to determine where to show the popover.The code:
I think you'll be able to get the desired result by tweaking the above.
Yes, you can do that. You have to create an aux view, with alpha=0.0f, and use it to guide the arrow.
For example:
Ok, now you open popover using that view as arrow's guide.
And now you only have to move the view:
Use animations for that move if you want.
One more thing, for this kind of arrow to button, I prefer that the arrow touches the button. You can use: