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

質問編集履歴

3

文字の追加

2021/03/18 05:46

投稿

downtowntown
downtowntown

スコア21

title CHANGED
File without changes
body CHANGED
@@ -168,4 +168,7 @@
168
168
  }
169
169
  }
170
170
  }
171
- ```
171
+ ```
172
+
173
+ ### 試したこと
174
+ NSMutableParagraphStyleのlineSpacing,paragraphSpacingを使って試したが変わらなかった

2

コードの追加

2021/03/18 05:46

投稿

downtowntown
downtowntown

スコア21

title CHANGED
File without changes
body CHANGED
@@ -63,12 +63,17 @@
63
63
  // create text Layer
64
64
  let titleLayer = CATextLayer()
65
65
  titleLayer.backgroundColor = UIColor.white.cgColor
66
- titleLayer.string = "Dummy text\nDummy text"
67
- titleLayer.font = UIFont(name: "Helvetica", size: 28)
68
66
  titleLayer.isWrapped = true
69
67
  titleLayer.truncationMode = .end
70
68
  titleLayer.alignmentMode = CATextLayerAlignmentMode.center
71
69
  titleLayer.frame = CGRect(x: 0, y: 50, width: size.width, height: size.height / 6)
70
+ var attributes: [NSAttributedString.Key: Any] = [.foregroundColor: UIColor.white, .font: UIFont.systemFont(ofSize: 26, weight: .bold)]
71
+ let paragraphStyle = NSMutableParagraphStyle()
72
+ paragraphStyle.lineSpacing = 0
73
+ paragraphStyle.alignment = .center
74
+ attributes.updateValue(paragraphStyle, forKey: .paragraphStyle)
75
+ let attributeString = NSAttributedString(string:"DuummyText\nDummuyText", attributes: attributes)
76
+ textLayer.string = attributeString
72
77
 
73
78
 
74
79
  let videolayer = CALayer()

1

脱字

2021/03/18 02:14

投稿

downtowntown
downtowntown

スコア21

title CHANGED
File without changes
body CHANGED
@@ -1,12 +1,6 @@
1
1
  ### 前提・実現したいこと
2
- 動画にテキストを
2
+ 動画にテキストを合成してカメラロールに保存するときにCATextLayerの行間を狭めて保存したい
3
3
 
4
- ### 発生している問題・エラーメッセージ
5
-
6
- ```
7
- エラーメッセージ
8
- ```
9
-
10
4
  ### Swift
11
5
 
12
6
  ```ここに言語名を入力
@@ -169,12 +163,4 @@
169
163
  }
170
164
  }
171
165
  }
172
- ```
166
+ ```
173
-
174
- ### 試したこと
175
-
176
- ここに問題に対して試したことを記載してください。
177
-
178
- ### 補足情報(FW/ツールのバージョンなど)
179
-
180
- ここにより詳細な情報を記載してください。