简体   繁体   中英

How can i move a subview to another view as its subview?

I have multiple views (A,B,C,D). B and C are subviews to A and D is a subview to B.

How can I move the view D from B to C? Ie i want D's superview to go from B to C.

I have tried

[D removeFromSuperview];
 D.frame = (CGRect){10,10,100,100};
[C addSubviews:D];

You wrote addSubviews instead of addSubview...

[D removeFromSuperview];
D.frame = (CGRect){10,10,100,100};
[C addSubview:D];

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM