A dragable, easy customizable, popup menu.
Use Carthage or drag SRPPopupMenu.h/.m into your project.
You should use your own menu, not SRPPopupMenu.
Follow the steps to create your custom menu or reference the DemoMenu class.
Create your custom menu subclass SRPPopupMenu.
Create a xib file named as your custom menu class name.
Disable the AutoLayout and Size-Class.
Drag a button to be MainButton, and connect to IBOutlet.
Drag some buttons to be otherButtons, and conncet to IBCollections.
Now you can use your custom menu.
// Show the menu
[YourMenu show];
// Hide the menu
[YourMenu hide];
Setup the follow property programmatically or on xib file
- (void)awakeFromNib
{
[super awakeFromNib];
self.mainButtonAnimationDuration = 0.4;
self.mainButtonAnimationDamping = 0.4;
self.actionButtonsAnimationDuration = 0.4;
self.actionButtonsAnimationDamping = 0.4;
self.actionButtonsPosionStartAngle = -90.0;
self.actionButtonsDistanceFromCenter = 120.0;
}
The SRPPopupMenu using NSNotification to handle button clicked,
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter]addObserver:self
selector:@selector(__menuButtonClickedNotification:)
name:SRPPopupMenuButtonClickedNotification
object:nil];
}
- (void)__menuButtonClickedNotification:(NSNotification *)sender
{
UIButton *button = sender.object;
}
If you want to handle the menu open / close, you must implement the SRPPopupMenuProtocol methods.
Also see DemoMenu class.
// Menu will open
- (void)menuWillOpen
// Menu opened
- (void)menuDidOpen
// Menu will close
- (void)menuWillClose
// Menu closed
- (void)menuDidClose