简体   繁体   中英

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.

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

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

in method:

 self.ViewWidth.constant =number;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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