質問するログイン新規登録

回答編集履歴

1

追記しました。

2018/05/08 21:05

投稿

newmt
newmt

スコア1277

answer CHANGED
@@ -49,4 +49,19 @@
49
49
  ```
50
50
 
51
51
  参考記事
52
- [https://stackoverflow.com/questions/31422247/issue-with-uitextfields-leftview-property](https://stackoverflow.com/questions/31422247/issue-with-uitextfields-leftview-property)
52
+ [https://stackoverflow.com/questions/31422247/issue-with-uitextfields-leftview-property](https://stackoverflow.com/questions/31422247/issue-with-uitextfields-leftview-property)
53
+
54
+
55
+ 【追記】
56
+ ```
57
+ extension UIView
58
+ {
59
+ func copyView<T: UIView>() -> T {
60
+ return NSKeyedUnarchiver.unarchiveObject(with: NSKeyedArchiver.archivedData(withRootObject: self)) as! T
61
+ }
62
+ }
63
+ ```
64
+
65
+ ```
66
+ bodyField.leftView = paddingView.copyView()
67
+ ```