0

I have a button that I need to move on viewDidLoad but it doesn't want to move... strange thing is that if I use the same exact code on a -(IBAction) then it moves as it should... any clue why is this happening? the code I'm using to move the button is this:

self.myButton.center = CGPointMake(50, 120);

thanks for any help. Peace, Massy

Blue
  • 2,300
  • 3
  • 21
  • 32
  • Try putting the code in `viewWillAppear:`. – msgambel Sep 28 '12 at 18:38
  • Are you sure the view has been loaded? If it hasn't, then the button won't be configured yet. Why not try putting `self.view.alpha = 1.0f` before you set the centre point? – msgambel Sep 28 '12 at 18:45
  • First of all thanks for your help, but it doesn't work neither with the alpha setting... I also noticed that if I put a timer of minimum 0.9 sec to call the same void with that code it works, but it only works if the time is not less then 0.9 and if after it there is the normal call to the void [self myVoid]; – Blue Sep 28 '12 at 18:57
  • I must add I'm on Xcode 4.5, maybe this strange beahviour is for something that has changed in this version of Xcode? – Blue Sep 28 '12 at 19:41
  • Maybe. I'm not quite sure why it is happening. Maybe put the code in an animation block, and then set the animation duration very low? – msgambel Sep 28 '12 at 20:26
  • Nothing... I also tryed to do a brand new project with just that code and it doesn't work at all... but if I call the animation from a IBAction then it works... this must be a bug... I will find some other way to go ahead... Thanks for your help. Peace, Massy – Blue Sep 29 '12 at 14:20

1 Answers1

1

For anyone that run in the same problem I found the solution in this tread: presentViewController: crash on iOS <6 (AutoLayout) removing the "Use Autolayout" option let my app work fine.

Community
  • 1
  • 1
Blue
  • 2,300
  • 3
  • 21
  • 32