小编diz*_*boy的帖子

如何在UIAlertController上添加动态按钮?

我正在使用UIActionSheet转换我的代码以使用UIAlertController.

我使用UIActionSheet的方式是这样的:

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Gender"
                                                         delegate:self
                                                cancelButtonTitle:nil
                                           destructiveButtonTitle:nil
                                                otherButtonTitles:nil];
for (NSDictionary *genderInfo in self.genderList) {
    NSString *gender = [[genderInfo objectForKey:@"description"] capitalizedString];
    [actionSheet addButtonWithTitle:gender];
}
[actionSheet addButtonWithTitle:@"Cancel"];
Run Code Online (Sandbox Code Playgroud)

只需处理代理行动表方法中按下的按钮.

在将其转换为警报控制器时,我注意到每个警报操作都有一个处理程序.我想知道如何实现警报控制器以获得可以处理操作的动态按钮.

objective-c ios uialertcontroller

3
推荐指数
2
解决办法
6729
查看次数

标签 统计

ios ×1

objective-c ×1

uialertcontroller ×1