-
Notifications
You must be signed in to change notification settings - Fork 112
Custom Position (Swift)
Weiping Huang edited this page May 13, 2017
·
2 revisions
Customize the number and positions of pieces and boom-buttons.
Swift | Objective-C
Sometimes we may want 12 boom-buttons or more, and perhaps we need to put the 12 pieces and boom-buttons to the positions that are not supported in BMB. Then you can customize number and positions of pieces and boom-buttons.
bmb.buttonEnum = .textInsideCircle
bmb.piecePlaceEnum = .custom
bmb.buttonPlaceEnum = .custom
for _ in 0..<3 {
bmb.addBuilder(BuilderManager.textInsideCircleButtonBuilder())
}
Then you need to tell BMB the positions of pieces:
bmb.customPiecePlacePositions.append(CGPoint.init(x: +6, y: -6))
bmb.customPiecePlacePositions.append(CGPoint.init(x: 0, y: 0))
bmb.customPiecePlacePositions.append(CGPoint.init(x: -6, y: +6))
And the positions of boom-buttons:
bmb.customButtonPlacePositions.append(CGPoint.init(x: -60, y: -60))
bmb.customButtonPlacePositions.append(CGPoint.init(x: 0, y: 0))
bmb.customButtonPlacePositions.append(CGPoint.init(x: +60, y: +60))
Notice that the coordinate system is the same as iPhone but the center position is (0, 0). And you don't need to customize both pieces and boom-buttons, check demo for more details.
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