此外,我希望这个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];
Run Code Online (Sandbox Code Playgroud) 我使用警报控制器创建了一个弹出警报,并添加了两个警报操作(确定和取消),如下所示.
UIAlertController * alert= [UIAlertController
alertControllerWithTitle:@"Cycling"
message:@"Please enter title and description"
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* ok = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[alert dismissViewControllerAnimated:YES completion:nil];
}];
UIAlertAction* cancel = [UIAlertAction
actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction:ok];
[alert addAction:cancel];
[self presentViewController:alert animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
现在,我想添加UITextView.因为我有两个文本字段,如标题和描述.为了描述我想使用UITextView添加no.of行.我试过我没有得到如何添加它.
请指教.