Such as the title, how to parent view subviews in the specified location display? My child views are half the size of the parent view, but a load of time, are covering the top part of the parent view, how could it not in the top display, ah,
Reply:
Set sub view of the frame property
Reply:
Remove the frame position set subview parent view at the top, but when you add subview need send to front.
[Self.view insertSubView: subview atIndex: 0];
Reply:
Do not understand what you mean.
Reply:
CGRect parentBounds = parentView.bounds;
CGFloat x = parentBounds.origin.x;
CGFloat y = parentBounds.origin.y + parentBounds.size.height / 2;
CGFloat width = parentBounds.size.width;
CGFloat height = parentBounds.size.height / 2;
subView.frame = CGRectMake (x, y, width, height);
/ / The above parentView is the parent view, remember to take bounds, rather than the frame, because the child view is a view in the parent relative coordinate system relative to the parent view instead grandfather view coordinate system. Normally these two coordinate systems are the same, but if the same is not scaled.
/ / SubView that you want to display subviews
Reply:
You simply need to do bounds.
Complex, you can see the resize in uikit
A word that is not clear
No comments:
Post a Comment