SajjadZare
SajjadZare

Reputation: 2378

Change size of view

I put a button on view and want to call this view from another view and change size of this view but when i change size,size of button doesn't change How can i change size of view that size of all controls on view changed?

Three *second = [[Three alloc] initWithNibName:@"Three" bundle:nil];
 second.view.frame=CGRectMake(0, 0, 100, 100);
 [self.view addSubview:second.view];

Upvotes: 1

Views: 3710

Answers (2)

burki
burki

Reputation: 2986

Set the frame for the view in the Interface Builder, you're using a nib anyway. But I think it's really strange what you made. You create a UIViewController and set the view of this controller as a subview of another controller's view. Why don't you directly compose that view in the same nib?

Upvotes: 1

joshim5
joshim5

Reputation: 2255

When the time comes to change the size of the view, at the following code.

second.view.frame = CGRectMake(a,b,c,d);

Where a, b, c, and d are integers.

Upvotes: 2

Related Questions