回答編集履歴
2
アウトレットの設定が正しくなかったのでコード部分を更新しました。
test
CHANGED
@@ -8,9 +8,7 @@
|
|
8
8
|
|
9
9
|
```C#
|
10
10
|
|
11
|
-
NSTextView textview = Input_TextView.DocumentView as NSTextView;
|
12
|
-
|
13
|
-
var stor = text
|
11
|
+
var stor = Input_TextView.TextStorage;
|
14
12
|
|
15
13
|
stor.BeginEditing();
|
16
14
|
|
@@ -24,8 +22,8 @@
|
|
24
22
|
|
25
23
|
```C#
|
26
24
|
|
27
|
-
NSTextView textview = Input_TextView.DocumentView as NSTextView;
|
28
|
-
|
29
|
-
Click_Label.StringValue = text
|
25
|
+
Click_Label.StringValue = Input_TextView.String;
|
30
26
|
|
31
27
|
```
|
28
|
+
|
29
|
+
![イメージ説明](6d28cc64d9e620b268a32292c5c3f864.png)
|
1
文字列を設定する方法を追記しました。
test
CHANGED
@@ -1,16 +1,30 @@
|
|
1
1
|
なるほど、そういった事情でしたか。
|
2
2
|
|
3
|
-
ではNSTextViewのStringで取得する方法はどうでしょうか。
|
3
|
+
ではNSTextViewのTextStorageで設定、Stringで取得する方法はどうでしょうか。
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
|
7
|
+
設定
|
8
8
|
|
9
9
|
```C#
|
10
10
|
|
11
11
|
NSTextView textview = Input_TextView.DocumentView as NSTextView;
|
12
12
|
|
13
|
+
var stor = textview.TextStorage;
|
13
14
|
|
15
|
+
stor.BeginEditing();
|
16
|
+
|
17
|
+
stor.Append(new NSAttributedString("test"));
|
18
|
+
|
19
|
+
stor.EndEditing();
|
20
|
+
|
21
|
+
```
|
22
|
+
|
23
|
+
参照
|
24
|
+
|
25
|
+
```C#
|
26
|
+
|
27
|
+
NSTextView textview = Input_TextView.DocumentView as NSTextView;
|
14
28
|
|
15
29
|
Click_Label.StringValue = textview.String;
|
16
30
|
|