标签:pods block uialertvie
https://github.com/jivadevoe/UIAlertView-Blocks
在Pods的Podfile里加入:
pod ‘UIAlertView-Blocks‘, ‘~> 1.0‘
运行命令:
pod update
RIButtonItem *cancelItem = [RIButtonItem itemWithLabel:@"No" action:^{
// this is the code that will be executed when the user taps "No"
// this is 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:^{
// this is the code that will be executed when the user taps "Yes"
// delete the object in question...
[context deleteObject:theObject];
}];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Delete This Item?"
message:@"Are you sure you want to delete this really important thing?"
cancelButtonItem:cancelItem
otherButtonItems: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
标签:pods block uialertvie
原文地址:http://blog.csdn.net/xundh/article/details/46431725