I have a few buttons on my View and when the app starts they should flip around their x-axis. When I start the app from Xcode (Build and then run the current scheme) they flip, but when I open the app on my iPhone they don't flip.
My viewDidLoad in my ViewController looks like this:
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
model =[[Model alloc] init];
GameView *gameView = [[GameView alloc] initWithTiles];
gameView.controller = self;
self.view = gameView;
[self flipButtons];
}
Why don't the buttons flip when I start the app from my phone?
If you need additional information just let me know :)
Edit
This is the method that flips the button and gets called for each button:
- (void)flip:(Color*)color {
int flipDirection = arc4random() % 2;
if(flipDirection == 0) flipDirection = -1;
double duration = 200 + arc4random() % (500 - 200);
duration = duration / 1000;
// Animation
[UIView animateWithDuration:duration
delay:0.0
options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction
animations:^{
self.layer.transform = CATransform3DMakeRotation(M_PI, 0, flipDirection, 0);
// wait duration /2 and call changeColor
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((duration / 2) * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self changeColor:color];
});
}
completion:^(BOOL finished) {
self.layer.transform = CATransform3DMakeRotation(M_PI, 0, 0, 0);
}];
}