Skip to content

Custom Position (Objective C)

Weiping Huang edited this page May 13, 2017 · 2 revisions

Customize the number and positions of pieces and boom-buttons.

Swift | Objective-C

Custom Position

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 = VHButtonTextInsideCircle;
bmb.piecePlaceEnum = VHPiecePlaceCustom;
bmb.buttonPlaceEnum = VHButtonPlaceCustom;

for (int i = 0; i < 3; i++)
{
    [bmb addBuilder:[BuilderManager textInsideCircleButtonBuilder]];
}

Then you need to tell BMB the positions of pieces:

[bmb.customPiecePositions addObject:[NSValue valueWithCGPoint:CGPointMake(+6, -6)]];
[bmb.customPiecePositions addObject:[NSValue valueWithCGPoint:CGPointMake(0, 0)]];
[bmb.customPiecePositions addObject:[NSValue valueWithCGPoint:CGPointMake(-6, +6)]];

And the positions of boom-buttons:

[bmb.customButtonPositions addObject:[NSValue valueWithCGPoint:CGPointMake(-60, -60)]];
[bmb.customButtonPositions addObject:[NSValue valueWithCGPoint:CGPointMake(0, 0)]];
[bmb.customButtonPositions addObject:[NSValue valueWithCGPoint:CGPointMake(+60, +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

  1. Basic Usage
  2. Simple Circle Button
  3. Text Inside Circle Button
  4. Text Outside Circle Button
  5. Ham Button
  6. Share Style
  7. Custom Position
  8. Button Place Alignments
  9. Different Ways to Boom
  10. Ease Animations for Buttons
  11. Different Order for Buttons
  12. Other Animations Attributes for Buttons
  13. Click Event and Listener
  14. Control BMB
  15. Use BMB in Navigation Bar
  16. Use BMB in Table View
  17. Attributes for BMB or Pieces on BMB
  18. Cache Optimization & Boom Area
  19. Change Boom Buttons Dynamically
  20. Blur Background & Tip
  21. Fade Views
  22. Structure of BMB
  23. Version History
Clone this wiki locally