I want to "remove" a UIView from a superview and add it again at the end... but at the "bottom" of the rest of the UIviews that belong to the superview.
Is this possible?
Any help is very appreciated!
Hmmm...
- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;
Might be what you're after? Alternatively -
- (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;
Though you could avoid removing the view all together (if you don't need to for any other reason) by calling sendSubviewToBack: -
- (void)sendSubviewToBack:(UIView *)view;
I don't really understand what you mean by bottom.
You can use: [view removeFromSuperview];
to remove it ( make sure you retain
it ( [view retain];
) before you do that and release
[view release];
when it's no longer needed.
Another thing you can do if you want one view to be behind another view is to set its "zPosition
" ( view.layer.zPosition = X;
)
if a View has a zPosition
that is bigger than another views zPosition
it will appear on top of the other view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With