相关疑难解决方法(0)

如何在iOS中的UIAlertview中插入UITextView

此外,我希望这个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];
Run Code Online (Sandbox Code Playgroud)

objective-c uialertview ios swift

10
推荐指数
2
解决办法
1万
查看次数

如何在UIAlertController中使用UITextView

我使用警报控制器创建了一个弹出警报,并添加了两个警报操作(确定和取消),如下所示.

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行.我试过我没有得到如何添加它.

请指教.

objective-c ios uialertcontroller

8
推荐指数
6
解决办法
2万
查看次数

标签 统计

ios ×2

objective-c ×2

swift ×1

uialertcontroller ×1

uialertview ×1