I'm trying to align in center two buttons in a single-view application. I don't want to use auto-layout, i try to solve this case programmatically. So in my ViewController.m, in the ViewDidLoad() function, i've put the following code:
_firstButton.center = CGPointMake(self.view.center.x, self.view.frame.size.height/2.0-235);
_secondButton.center = CGPointMake(self.view.center.x, _secondButton.frame.size.height/2.0+(self.view.frame.size.height*0.9));
The secondButton is correctly positioned in any screen, on any device and on any simulator. The firstButton is positioned right only in iphone 5 and 5S simulators, but it does not even show up in my iPhone 5C device or the iPhone 6 & 6 Plus simulators.
What am i doing wrong, what do i miss here?
Thanks in advance
ps: objective-c noob here, sorry if that's a too dumb question
0 comments:
Post a Comment