-2

How can I create the rotating buttons(Please check screenshot) ? I want to rotate all the buttons in the clock wise direction. If I select any one of the button, it will do some actions. How can I handle this kind of designs ? Please give any sample source code like this (or) give some suggestions about this task. Thanks in advance.

enter image description here

Larme
  • 24,190
  • 6
  • 51
  • 81
Mani
  • 1,310
  • 1
  • 20
  • 40
  • 1
    Note that the UIButton under animation will not respond for the user clicks – Mutawe Mar 11 '14 at 13:41
  • http://stackoverflow.com/questions/13791582/cgaffinetransformmakerotation-counter-clockwise-always – Rushabh Mar 11 '14 at 13:42
  • Button clicks are working correctly, but the button tags are changed when rotating the button(change the layer of the button). – Mani Mar 11 '14 at 13:44
  • "Please give any sample source code" that is not how SO work. You should ask a specific question about a problem that you have and we can help you solve it. If you want someone to write a component for your app then you should hire a contractor. – David Rönnqvist Mar 11 '14 at 14:10

3 Answers3

0

There is iCarousel class you can implement and add the buttons to the rotating views. It basically works as the table view but also rotates cells. You can add the buttons instead of cells and rotate them any way you want.

MaksTheAwesome
  • 138
  • 1
  • 8
0

First you need container view to have all your buttons, then you need to get x and y for every button on the container by having the R which is the radius from the centre of the container to the centre of the button and the minimum angle between buttons.
Here is a tutorial similar to what you want to achieve http://www.raywenderlich.com/9864/how-to-create-a-rotating-wheel-control-with-uikit

Basheer_CAD
  • 4,908
  • 24
  • 36
0

First you call the timer in viewdidload:

NSTimer *timer1 = [NSTimer scheduledTimerWithTimeInterval:0.02f 
                      target: self 
                      selector: @selector(rotatethecircle) 
                      userInfo: nil repeats: YES];
[timer1 fire];

Then the timer method, to use the CGAffineTransform:

-(void)rotatethecircle{

    CGAffineTransform cgaRotate = CGAffineTransformMakeRotation(-angle*PHI);
    CGAffineTransform buttonRotate = CGAffineTransformMakeRotation(angle*PHI);

    viewRotate.transform = cgaRotate;
    buttonCircleFirst.transform = buttonRotate;
    buttonCircleSecond.transform = buttonRotate;
    angle=angle+4;

}
Bjørn-Roger Kringsjå
  • 9,849
  • 6
  • 36
  • 64
Nandhakumar
  • 64
  • 2
  • 12