質問編集履歴
5
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -167,3 +167,7 @@
|
|
167
167
|
}
|
168
168
|
|
169
169
|
```
|
170
|
+
|
171
|
+
無事動きましたm(_ _)m
|
172
|
+
|
173
|
+
![イメージ説明](363a181b366594b29898eecf523e68ea.png)
|
4
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -125,3 +125,45 @@
|
|
125
125
|
![イメージ説明](f09b385cd279b46c9058c6b369b67124.png)
|
126
126
|
|
127
127
|
![イメージ説明](9ea2a8c90424359d85c5e9da3cd105a1.png)
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
**追記3**
|
132
|
+
|
133
|
+
StoryBoard
|
134
|
+
|
135
|
+
![イメージ説明](9a4d3b0cbb3b65af3c07fd4408a8d69a.png)
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
コード
|
140
|
+
|
141
|
+
```ここに言語を入力
|
142
|
+
|
143
|
+
/// キーボードが表示時に画面をずらす。
|
144
|
+
|
145
|
+
@objc func keyboardWillShow(_ notification: Notification?) {
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
let keyboardFrame = (notification?.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue
|
150
|
+
|
151
|
+
let duration = notification?.userInfo?[UIKeyboardAnimationDurationUserInfoKey]
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
UIView.animate(withDuration: duration as! TimeInterval, animations: {
|
156
|
+
|
157
|
+
let transform = CGAffineTransform(translationX: 0, y: -(keyboardFrame?.size.height)!)
|
158
|
+
|
159
|
+
self.view.transform = transform
|
160
|
+
|
161
|
+
},completion:nil)
|
162
|
+
|
163
|
+
topview.isHidden = false
|
164
|
+
|
165
|
+
subwriteviewconstraint.constant = 71
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
```
|
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -115,3 +115,13 @@
|
|
115
115
|
5行ほどUITextViewにて改行を行った時のUIView
|
116
116
|
|
117
117
|
![イメージ説明](15b28aa09fda642ab6ea91cc73580ea0.png)
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
**追記2**
|
122
|
+
|
123
|
+
AutoLayout Storyboard
|
124
|
+
|
125
|
+
![イメージ説明](f09b385cd279b46c9058c6b369b67124.png)
|
126
|
+
|
127
|
+
![イメージ説明](9ea2a8c90424359d85c5e9da3cd105a1.png)
|
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -112,6 +112,6 @@
|
|
112
112
|
|
113
113
|
```
|
114
114
|
|
115
|
-
|
115
|
+
5行ほどUITextViewにて改行を行った時のUIView
|
116
116
|
|
117
117
|
![イメージ説明](15b28aa09fda642ab6ea91cc73580ea0.png)
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -91,3 +91,27 @@
|
|
91
91
|
|
92
92
|
|
93
93
|
```
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
**追記**
|
98
|
+
|
99
|
+
UIViewを以下のようにCGRectで指定したところ高さは可変するようになったのですが今度はtextviewの高さが不変になりました。
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
```ここに言語を入力
|
104
|
+
|
105
|
+
// textviewの位置調整
|
106
|
+
|
107
|
+
msg.frame = CGRect(x: msg.frame.origin.x, y: msg.frame.origin.y, width: msg.frame.width, height: height)
|
108
|
+
|
109
|
+
// 新たに背景のUIViewの高さも動くように設定
|
110
|
+
|
111
|
+
backui.frame = CGRect(x: backui.frame.origin.x, y: backui.frame.origin.y , width: backui.frame.width, height: height + backui.frame.height)
|
112
|
+
|
113
|
+
```
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
![イメージ説明](15b28aa09fda642ab6ea91cc73580ea0.png)
|