另外,我希望此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];
以下链接解决了我的问题,该链接为https://github.com/wimagguc/ios-custom- alertview
以下内容已解决
两种功能对我来说都很好