0
votes

For some very strange reason I cannot change the size of my UIButtons. I have a UIButton connected to an action that triggers a method to change the height and width of another button in this way:

- (IBAction)Button1Camera:(id)sender {
self.Button2.frame = CGRectMake(self.Button2.frame.origin.x, 100, 100, 100);
self.Button1.frame = CGRectMake(50, 50, 300, 300);
}

both buttons are connected and are originally size 100, 100. I notice that when I set these to 100, the button moves, but when I try changing size (300) the button neither moves, nor changes size. This is impossible, I have always done it like this! Since I downloaded Xcode 5 only yesterday, I think this might have been the cause. It could have changed Xcode 4 settings, but the project was never opened in Xcode 5. I also tried creating a new project, but the error persists.

2
What happens if you call [self.Button1 setNeedsLayout] and [self.Button2 setNeedsLayout] ?www.jensolsson.se
The properties are nil. Hook them up as connections in your xib.Kevin

2 Answers

1
votes

The reason why the size was not changing is that the new xcode had checked in autolayout. By removing it the problem was solved

0
votes

Make IBOutlet of Button1 and Button2.Connect them with the respective buttons in IB