使用第三方的支持Block 的UIAlertView

github 网址:

https://github.com/jivadevoe/UIAlertView-Blocks

使用

在Pods的Podfile里加入:

pod ‘UIAlertView-Blocks’, ‘~> 1.0’

运行命令:

pod update

代码RIButtonItem *cancelItem = [RIButtonItem itemWithLabel:@”No” action:^{the code that will be executed optional… if you leave the action as nil, it won’t do anything// but here, I’m showing a block just to show that you can use one if you want to.}];RIButtonItem *deleteItem = [RIButtonItem itemWithLabel:@”Yes” action:^{the code that will be executed the object in question…[context deleteObject:theObject];}];UIAlertView *alertView = [[UIAlertView alloc] :cancelItemotherButtonItems:deleteItem, nil];[alertView show];

也可以初始化后添加按钮

[alertView addButtonItem:deleteItem];其它问题

我在使用时,提示:

ld: library not found for -lPods-UIAlertView-Blocks clang: error: linker command failed with exit code 1 (use -v to see invocation) (null): Library not found for -lPods-UIAlertView-Blocks (null): Linker command failed with exit code 1 (use -v to see invocation)

处理方法: 把项目和Pods的Architectures设置一致:

在Podfile里加入:

post_install do |installer| installer.project.targets.each do |target| target.build_configurations.each do |config| config.build_settings[‘ARCHS’] = “armv7” end end end

,往往为了自己的不能失败,而处心积虑前怕狼后怕虎,

使用第三方的支持Block 的UIAlertView

相关文章:

你感兴趣的文章:

标签云: