iphone - UIView subclass won't autoresize -
I am looking for background information about resizing, but I can not find much. I know that I need to set the Autorisizasubues
and Autoricing Mask
on the subview.
I did this, and my UIImageViews have to resize properly, but my custom UIView subclass is not.
Code for UIImageView:
UIImageView * newX = [[[UIImageView alloc] initWithImage: dot] autorelease]; [NewX Setautorizing Mask: UIViewAutoresizingFlexibleWidth]; [NewX Setframe: CGRactMake (0, 0, Self W. Bounds Skies, Wide, 1)]; [Self.view addSubview: newX];
Code for the custom UIView subclass:
trace = [[traceview light] initWithFrame: self.view.bounds]; [Trace setautorizingmask: (UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin)]; [Self.view addSubview: trace];
What can I tell, the scene revolves around as expected, but its size is not changing now I can not see it below, and it does not fill the screen on the right To change the work properly, do anything in the UIVUE sub-classroom?
Edit: I have made a change automatically by typing (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHyight)
and [subview setNeedsDisplay];
I'm not sure why this is necessary because UIImageViews work fine without it, but it now behaves as expected.
I think you are missing out on the UIViewAutoresizingFlexibleHyight
or the width on the subview . Otherwise, I think that the scene revolves around the margins only, but its size is not changed.
Comments
Post a Comment