ios - ios8 中 uialertview 中的复选框

标签 ios iphone checkbox uialertview uialertcontroller

我想添加如下图所示的复选框

Expected behaviour

下面是我的代码:

UIButton *nameField = [[UIButton alloc] initWithFrame:CGRectMake(120, 0, 30, 30.0)];
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 250, 50)];
[v setBackgroundColor:[UIColor clearColor]];
[nameField setImage:[UIImage imageNamed:@"unchecked.png"] forState:UIControlStateNormal];
[v addSubview:nameField];
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Delete selected pods from server?" message:
                   @"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
[av setValue:v  forKey:@"accessoryView"];
av.message = @"This will delete all the posts related to the pictures you want to delete!";
[av show];

使用上面的代码我得到的是:

enter image description here

我想在消息旁边获取复选框..

有什么帮助或建议如何继续吗?

最佳答案

您可以使用https://github.com/wimagguc/ios-custom-alertview 创建您的自定义内容 View 并将其设置为

CustomIOS7AlertView *alertView = [[CustomIOS7AlertView alloc] init];

UIView *customView ..;  //Your custom view

[alertView setContainerView:customView];

关于ios - ios8 中 uialertview 中的复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28826529/

相关文章:

iOS - 在使用成功 block 进行异步网络调用时查看 Controller 内存管理

ios - 当设备方向改变时改变 ViewController?

ios - 在应用商店(应用内)方法上评分 - 错误 : "Your request produced an error. [newNullLineResponse]". 重新提交新应用

binding - JavaFX TableView 中的问题绑定(bind)复选框

python - 获取 QListWidget 中选定复选框的索引

ios - 如何使单元格高度适合屏幕

iphone - iOS:录制语音编码的音频格式,用于网络传输

ios - Segue 后向上滚动时 UITableView 滞后

iphone - MKMapView不会添加任何注释

java - JCheckbox 更改监听器收到鼠标悬停事件的通知