Using this to copy UIView
UIView copyOfView =
[NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:originalView]]
This throws the following error:
NSInvalidUnarchiveOperationException
[NSKeyedUnarchiver decodeBoolForKey]: value for key (UIHighlighted) is not a boolean
If we are using Archive/Unarchive
with UIImageView
, I am facing error, though I fixed that highlight issue.
let NewView = whichView.snapshotView(afterScreenUpdates: true)!
The above line will give you best solution.
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