f00*_*man 3 uitableview uialertview ios7
做了一些谷歌搜索看到iOS 7不再支持子视图.
一些人建议创建自定义视图,但我不知道我该怎么做.
这是我的代码,有人能指出我正确的方向吗?
-(IBAction)click_select_fruit_type
{
select_dialog = [[[UIAlertView alloc] init] retain];
[select_dialog setDelegate:self];
[select_dialog setTitle:@"Fruit Type"];
[select_dialog setMessage:@"\n\n\n\n"];
[select_dialog addButtonWithTitle:@"Cancel"];
idType_table = [[UITableView alloc]initWithFrame:CGRectMake(20, 45, 245, 90)];
idType_table.delegate = self;
idType_table.dataSource = self;
[select_dialog addSubview:idType_table];
[idType_table reloadData];
[select_dialog show];
[select_dialog release];
}
Run Code Online (Sandbox Code Playgroud)
mal*_*lex 13
您可以更改accessoryView的任何自己customContentView在iOS7标准警报视图
[alertView setValue:customContentView forKey:@"accessoryView"];
Run Code Online (Sandbox Code Playgroud)
请注意,您必须在[alertView show]之前调用它.
最简单的说明示例:
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"TEST" message:@"subview" delegate:nil cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil];
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 50)];
v.backgroundColor = [UIColor yellowColor];
[av setValue:v forKey:@"accessoryView"];
[av show];
Run Code Online (Sandbox Code Playgroud)

Real tableView作为UIAlertView示例的子视图:

| 归档时间: |
|
| 查看次数: |
9910 次 |
| 最近记录: |