Alessandro
Alessandro

Reputation: 4100

UIButton size not changing

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.

Upvotes: 0

Views: 493

Answers (2)

Alessandro
Alessandro

Reputation: 4100

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

Upvotes: 1

Apoorv
Apoorv

Reputation: 412

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

Upvotes: 0

Related Questions