简体   繁体   English

更改情节提要中已经存在的UIView的宽度? 迅速

[英]Change the width of a UIView that already exists in Storyboard? Swift

I already have created a UIView in the storyboard and connected it as an outlet, with the name progressView In Swift, I want to be able to change the width of this view in a certain function, however, so far I have been unable to. 我已经在情节提要中创建了一个UIView并将其作为插座连接,名称为progressView在Swift中,我希望能够在某些功能中更改此视图的宽度,但是到目前为止,我还无法实现。

I would really appreciate any help. 我真的很感谢您的帮助。

I've just write an example , if your project is autolayout , you need to define width constraint for progressView , then you need to make an outlet connection from your constraint and then change this property at method 我只是写一个示例,如果您的项目是autolayout,则需要为progressView定义宽度约束,然后需要从约束建立出口连接,然后在method处更改此属性。

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *ViewWidth;

in method: 在方法中:

 self.ViewWidth.constant =number;

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

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