Скопировать/клонировать UIView в Swift в 2021 году? ⇐ IOS
Скопировать/клонировать UIView в Swift в 2021 году?
There some similar questions but the answers use deprecated methods.
My solution which is similar to them but with modern methods:
func copyObject() throws -> T? { let data = try NSKeyedArchiver.archivedData(withRootObject:self, requiringSecureCoding:false) return try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as? T } The problem is it doesn't work fully (and it seems the other questions-answers have the same problem) - one of subviews has corner radius which is not copied. How to solve this issue?
Источник: https://stackoverflow.com/questions/686 ... ft-in-2021
There some similar questions but the answers use deprecated methods.
My solution which is similar to them but with modern methods:
func copyObject() throws -> T? { let data = try NSKeyedArchiver.archivedData(withRootObject:self, requiringSecureCoding:false) return try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as? T } The problem is it doesn't work fully (and it seems the other questions-answers have the same problem) - one of subviews has corner radius which is not copied. How to solve this issue?
Источник: https://stackoverflow.com/questions/686 ... ft-in-2021
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Как преобразовать строковую дату (25 января 2021 г.) в дату г-м-д (2021-01-01) в Python
Anonymous » » в форуме Python - 0 Ответы
- 15 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Какое время проверки App Store Connect (iOS) считается ненормальным в 2021 году?
Anonymous » » в форуме IOS - 0 Ответы
- 64 Просмотры
-
Последнее сообщение Anonymous
-