objective c - How do I programmatically change the size a UIImageView that was created on storyboard with autolayout? -
i have outlet uiimageview hooked storyboard header file. trying alter frame of uiimageview programmatically implementation file. have done following:
-(void)viewdidload{ [super viewdidload]; if (is_iphone_5) { someimageview.frame = cgrectmake(someimageview.frame.origin.x, someimageview.frame.origin.y, someimageview.frame.size.width - 50, someimageview.frame.size.height - 50); } }
no matter change width , height doesn't seem change. using autolayout , have constraints hooked imageview? if so, how override these change image view's height , width?
is there simpler way storyboard?
thanks in advance.
you might want reevaluate constraints set in ib. make sure don't have width or height constraints, instead top/bottom/leading/trailing constraints. don't have programmatically. if must resize programmatically, create iboutlet
references constraints in storyboard, , can adjust constant
property of constraint. don't attempt change frame
if you're using constraints.
Comments
Post a Comment