简体   繁体   English

变更检视大小

[英]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];

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. 其中a,b,c和d是整数。

Set the frame for the view in the Interface Builder, you're using a nib anyway. 在Interface Builder中设置视图的框架,无论如何您都在使用笔尖。 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. 您创建一个UIViewController并将此控制器的视图设置为另一个控制器视图的子视图。 Why don't you directly compose that view in the same nib? 您为什么不直接在同一笔尖中构成该视图?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM