开发者

iOS: Create a borderless popover

How is the calendar app on the iPad doing a borderless popover? I've done several on Mac OS with a NSWindow, but on iOS how would one imp开发者_StackOverflowlement it?, especially the rounded borders? I also want to be able to move it around while its being displayed Any pointers on how to get started?, Thank you.

iOS: Create a borderless popover


It's probably a custom view. I don't believe it's actually a UIPopoverController. We can't really know for certain though because it's an implementation detail that Apple hasn't described.

If I were tasked with recreating it, I would build a custom view rather than attempt to modify UIPopoverController.


IIRC the popover controller has a property/ivar called "popoverStyle" which is an integer; you can play around with it semi-legally doing something like [popoverController setValue:[NSNumber numberWithInt:1] forKey:@"popoverStyle"]. IIRC there's a popover style with a white background; I'm not sure exactly where the 1px outline comes from.

This is highly likely to break in future OS versions even if your app is accepted by Apple (it probably is, since it's "just" KVC). Only do this if you're prepared to commit to testing on beta OSes and fixing bugs in time for the final release, otherwise your (paying?) customers might end up with an app that merely crashes.


If you decide to recreate as per Jonathan's answer, look into WEPopover before you do and see if it meets your needs.

https://github.com/werner77/WEPopover

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜