Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone, ipad Duplicate UIView - Cloned View

How to Duplicate a UIView. requirement is there should be two views inside a view for ex consider View A and View B. changing one view also should change another view.

for example consider am added a mpmediaplayer in view A means view B should show same video which is there in view A and if i moving anything in view A means ie forwarding video, volume control etc.. the scond view shold display the same thing.

like image 560
nik Avatar asked Jan 23 '26 06:01

nik


1 Answers

There is no easy way to clone a view and then to update two views by one line of code. Because their underlying CALayers are different. But for duplicating a UIView, here is a new method you can use: Use UIView's method:

- (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates

This is the fastest way to draw a view. Available in iOS 7.

like image 106
Lei Zhang Avatar answered Jan 25 '26 18:01

Lei Zhang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!