2

Please see the image below.

How was this 'pop-up' view created? Suppose I wanted to completely imitate that view with the fonts, how would I do so?

enter image description here

joshim5
  • 2,292
  • 4
  • 28
  • 40
  • 3
    It's just a custom view with several subviews: background UIImageView, three UIButtons, one UILabel and one UISwitch. – beryllium Oct 28 '11 at 14:34
  • 1
    It's simply a Custom View! Like this: http://stackoverflow.com/questions/4769169/iphone-popup-menu-like-ipad-popover easy to do! – elp Oct 28 '11 at 14:47

2 Answers2

4

There is not a SDK exposed component for this, but this could very easily be made using a hierarchy of views:

UIView - Main view. Uses a bezier path to create a protrusion to point from the source. Has a border and drop shadow added to its layer.

UIButton - Smaller font
UIButton - Larger font
UIButton - Change font type
UIButton - Container for sepia.
UILabel - "Sepia" text UISwitch - turning sepia on and off

Just show and hide the view with an animation. Also, create delegate callbacks to tell the delegate when events occur in the popover.

// Delegate returns if the text can get smaller to enable/disable the button
- (BOOL) didSelectSmallerFont:(CGFloat)fontSize;
// Delegate returns if the text can get larger to enable/disable the button
- (BOOL) didSelectLargerFont:(CGFloat)fontSize; 
- (void) didChangeFont:(UIFont*)font;
- (void) didToggleSepia:(BOOL)enabled;

etc.

Wayne Hartman
  • 18,369
  • 7
  • 84
  • 116
  • 1
    Good answer +1, but to be more modern (and assuming you're targeting iOS 4.0+) you should use blocks instead of callbacks. – kubi Oct 28 '11 at 14:56
  • @kubi - Exactly what I was thinking while reading this... Thanks! – joshim5 Oct 28 '11 at 21:21
0

The pyramid shape is not associated with the button that was clicked to present the popup. It would be a subview of the popup view, either a UIImageView or possibly drawn on a UIView, although a UIImageView would be the easier solution. You could definitely code the popup view to point that arrow at any point on the screen or in any direction. What I would do is instantiate the popup by means of an init method called initFromPoint:, then pass the center value of the button used to launch the popup. Then within the viewDidLoad method of the popup place the point appropriately based on the point.

RyJ
  • 3,995
  • 6
  • 34
  • 54