-
Notifications
You must be signed in to change notification settings - Fork 112
Click Event and Listener (Objective C)
Weiping Huang edited this page May 13, 2017
·
2 revisions
Listener for clicking each button or animation-states. Check the demo for more details.
Swift | Objective-C
You can add a simple clicked-block for each boom-button by adding listeners to each builder of them.
for (int i = 0; i < self.bmb.pieceNumber; i++)
{
VHSimpleCircleButtonBuilder *builder = [VHSimpleCircleButtonBuilder builder];
// Event block when the boom-button corresponding the builder itself is clicked.
builder.clickedBlock = ^(int index) {
// the boom-button is clicked
};
[self.bmb addBuilder:builder];
}
If you want to manager all the click events in one method, you can use VHBoomDelegate:
...
bmb.boomDelegate = self;
...
- (void)boomMenuButton:(VHBoomMenuButton *)bmb didClickBoomButtonOfBuilder:(VHBoomButtonBuilder *)builder at:(int)index
{
// If you have implement clickedBlocks for boom-buttons in builders,
// then you shouldn't add any listener here for duplicate callbacks.
// self.buttonLabel.text = builder.normalImageName;
}
- (void)boomMenuButtonDidClickBackground:(VHBoomMenuButton *)bmb
{
self.animationLabel.text = @"Click background!!!";
}
- (void)boomMenuButtonWillReboom:(VHBoomMenuButton *)bmb
{
self.animationLabel.text = @"Will RE-BOOM!!!";
}
- (void)boomMenuButtonDidReboom:(VHBoomMenuButton *)bmb
{
self.animationLabel.text = @"Did RE-BOOM!!!";
}
- (void)boomMenuButtonWillBoom:(VHBoomMenuButton *)bmb
{
self.animationLabel.text = @"Will BOOM!!!";
}
- (void)boomMenuButtonDidBoom:(VHBoomMenuButton *)bmb
{
self.animationLabel.text = @"Did BOOM!!!";
}
Get the states of BMB by:
bmb.isAnimating // Whether BMB is animating.
bmb.isBoomed // Whether BMB is boomed.
bmb.isReBoomed // Whether BMB is re-boomed.
Home
Chapters
- Basic Usage
- Simple Circle Button
- Text Inside Circle Button
- Text Outside Circle Button
- Ham Button
- Share Style
- Custom Position
- Button Place Alignments
- Different Ways to Boom
- Ease Animations for Buttons
- Different Order for Buttons
- Other Animations Attributes for Buttons
- Click Event and Listener
- Control BMB
- Use BMB in Navigation Bar
- Use BMB in Table View
- Attributes for BMB or Pieces on BMB
- Cache Optimization & Boom Area
- Change Boom Buttons Dynamically
- Blur Background & Tip
- Fade Views
- Structure of BMB
- Version History