您的位置:首页 > 其它

自定义Alert

2015-06-16 15:59 176 查看
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"添加明星阵容" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"添加", nil];
//UIView *view = [[UIView alloc]initWithFrame:CGRectMake(180, 5, 85, 155)];

UIScrollView *scroll=[[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 400, 155)];

[scroll setContentSize:CGSizeMake(400, 1280)];
scroll.delegate = self;
//[view addSubview:scroll];

for (int i = 0; i < [arr count]; i ++) {
UIButton *btn = [[UIButton alloc] init];
//btn.frame = CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)
}

UIButton *btn=[[UIButton alloc] initWithFrame:CGRectMake(0, 0, 80, 45)];
btn.backgroundColor = [UIColor redColor];
[btn setTitle:[arr objectAtIndex:2] forState:UIControlStateNormal];
[scroll addSubview:btn];

if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
[alertView setValue:scroll forKey:@"accessoryView"];
}else{
[alertView addSubview:scroll];
}

[alertView show];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: