简体   繁体   English

如何将 UITextView 放入 UIAlertView?

[英]How can I place a UITextView into a UIAlertView?

How can I put a UITextView in an UIAlertView ?如何将UITextView放在UIAlertView中?

Also, I would like this UITextView to mirror a text file at /var/mobile/file.txt .另外,我希望这个UITextView镜像/var/mobile/file.txt的文本文件。 How can I make it so that anything that is changed in the UITextview would be written to the file.txt ?我怎样才能使UITextview中更改的任何内容都写入file.txt

You can take textView as an instance variable for later access.您可以将 textView 作为实例变量供以后访问。 add textview as subview in alertview.在 alertview 中添加 textview 作为子视图。 when alert dismissed get the text of textview and write to that file by using [writeToPath atomic] method.当警报解除时,获取 textview 的文本并使用 [writeToPath atomic] 方法写入该文件。 Hope you understand.希望你能理解。

Just put this before show your alert:只需在显示警报之前输入:

UITextView *yourtextview = [[UITextView alloc] initWithFrame:CGRectMake(12, 90, 260, 50)]; 
[youralert addSubview:yourtextview];

Yes I actually understand.是的,我其实明白。 I did something like that.我做了类似的事情。

So its:所以是:

UIAlertView *lol UIAlertView *大声笑
UITextView *lolTwo UITextView *lolTwo
... ...
[lol addSubview:lolTwo]; [大声笑 addSubview:lolTwo];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM