I need to update UIView size.
Now i use
var titleSize = CGRectMake(0, 30, 40 , 1000)
self.contentCoverScrollView.frame = titleSize
in viewDidLoad, but nothing happens.
In Autolayout if you want to change the frame then try the constraints ( IBOutlet
of NSLayoutConstraint
).
Set the constraint outlets and change constant
value by :
self.sampleConstraint.constant = 20
self.view.layoutIfNeeded()
I thought you had used the AutoLayout in your application that's why it can not change the view frame, please write the below code.
var titleSize = CGRectMake(0, 30, 40 , 1000)
self.contentCoverScrollView.frame = titleSize
[self.contentCoverScrollView updateConstraintsIfNeeded];
Note : updateConstraintsIfNeeded will tell the system to recalculate the constraints in that particular moment of execution.
看起来您想更改ScrollView的大小使用:
[self.contentCoverScrollView setContentSize:(CGSizeMake(40, 1000))];
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.