小编典典

如何在iOS中将UITextView插入UIAlertview

swift

另外,我希望此UITextView带有XXX.txt中的文本文件。它在i​​OS6中可以正常工作,但内容不会出现在iOS7的UIAlertview中。我的代码如下:

UITextView *tosTextView = [[UITextView alloc]initWithFrame:CGRectMake(12, 48, 260, 140)];

NSString *path = [[NSBundle mainBundle] pathForResource:@"TJTermsof Service"
                                                 ofType:@"txt"];
NSString *content = [NSString stringWithContentsOfFile:path
                                              encoding:NSUTF8StringEncoding
                                                 error:NULL];
[tosTextView setText:content];

tosTextView.textColor=[UIColor blackColor];
tosTextView.font = [UIFont fontWithName:@"LuzSans-Book" size:17];
tosTextView.editable = NO;
customAlert = [[UIAlertView alloc]initWithTitle:@" TOS \n\n\n\n\n\n " message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"I Agree",nil];



[customAlert addSubview:tosTextView];

[customAlert show];

阅读 287

收藏
2020-07-07

共1个答案

小编典典

以下链接解决了我的问题,该链接为https://github.com/wimagguc/ios-custom-
alertview

以下内容已解决

  1. 文字检视
  2. 表格检视
  3. 影像检视
  4. UIWebView

两种功能对我来说都很好

2020-07-07