Search code examples
iosobjective-cuiviewios6uipopovercontroller

Creating a custom popover for iPhone - what class do I subclass?


I saw this question here (How to create popover in iPhone app?), and wanted to design a class that could create a popover object, I find all the libraries for popovers right now aren't doing quite what I'd like to do.

So I figure I'll create my own, but I'm a little new at it. Do I subclass UIView directly? Could anyone point me in the right direction for this task?


Solution

  • Subclass UIView. Implement the layerClass class method of your custom UIView subclass and return [CAShapeLayer class] (from the QuartzCore framework), or use your own subclass of CAShapeLayer instead of CAShapeLayer itself. In your UIView subclass' implementation of initWithFrame: you can set the view's layer's path to get the popover shape you want to display.