另外,我想要将这个UITextView与XXX.txt文件中的文本一起使用。在iOS6中它可以正常工作,但在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];