├── ._BAButton ├── ._BAButton.podspec ├── ._BAButtonDemo ├── ._LICENSE ├── ._README.md ├── .gitignore ├── .swift-version ├── BAButton.podspec ├── BAButton ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ └── BAButton │ ├── BAButton.h │ ├── BAButton_Version.h │ ├── BAKit_ConfigurationDefine.h │ ├── UIButton+BACountDown.h │ ├── UIButton+BACountDown.m │ ├── UIButton+BAKit.h │ ├── UIButton+BAKit.m │ ├── UIButton+BAState.h │ ├── UIButton+BAState.m │ ├── UIView+BARectCorner.h │ └── UIView+BARectCorner.m ├── Example ├── BAButton.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── BAButton-Example.xcscheme │ └── xcuserdata │ │ └── Alria.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── BAButton.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ ├── Alria.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── sunboyan.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist ├── BAButton │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── tabbar_mainframeHL.imageset │ │ │ ├── Contents.json │ │ │ ├── tabbar_mainframeHL@2x.png │ │ │ └── tabbar_mainframeHL@3x.png │ │ └── 倒计时 │ │ │ ├── Contents.json │ │ │ ├── Countdown_01.imageset │ │ │ ├── Contents.json │ │ │ ├── oneT@2x.png │ │ │ └── oneT@3x.png │ │ │ ├── Countdown_02.imageset │ │ │ ├── Contents.json │ │ │ ├── twoT@2x.png │ │ │ └── twoT@3x.png │ │ │ ├── Countdown_03.imageset │ │ │ ├── Contents.json │ │ │ ├── threeT@2x.png │ │ │ └── threeT@3x.png │ │ │ ├── Countdown_04.imageset │ │ │ ├── Contents.json │ │ │ ├── fourT@2x.png │ │ │ └── fourT@3x.png │ │ │ └── Countdown_05.imageset │ │ │ ├── Contents.json │ │ │ ├── fiveT@2x.png │ │ │ └── fiveT@3x.png │ ├── BAAppDelegate.h │ ├── BAAppDelegate.m │ ├── BAButton-Info.plist │ ├── BAButton-Prefix.pch │ ├── BAViewController.h │ ├── BAViewController.m │ ├── Launch Screen.storyboard │ ├── Main.storyboard │ ├── Resources │ │ ├── begin.mp3 │ │ ├── failure.mp3 │ │ └── 条形码.jpg │ ├── ViewController2.h │ ├── ViewController2.m │ ├── ViewController2.xib │ ├── ViewController3.h │ ├── ViewController3.m │ ├── ViewController3.xib │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m ├── Podfile ├── Podfile.lock └── Pods │ ├── Local Podspecs │ └── BAButton.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ ├── Alria.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── sunboyan.xcuserdatad │ │ └── xcschemes │ │ ├── BAButton.xcscheme │ │ ├── Pods-BAButton_Example.xcscheme │ │ ├── Pods-BAButton_Tests.xcscheme │ │ └── xcschememanagement.plist │ └── Target Support Files │ ├── BAButton │ ├── BAButton-Info.plist │ ├── BAButton-dummy.m │ ├── BAButton-prefix.pch │ ├── BAButton-umbrella.h │ ├── BAButton.modulemap │ └── BAButton.xcconfig │ ├── Pods-BAButton_Example │ ├── Pods-BAButton_Example-Info.plist │ ├── Pods-BAButton_Example-acknowledgements.markdown │ ├── Pods-BAButton_Example-acknowledgements.plist │ ├── Pods-BAButton_Example-dummy.m │ ├── Pods-BAButton_Example-frameworks.sh │ ├── Pods-BAButton_Example-umbrella.h │ ├── Pods-BAButton_Example.debug.xcconfig │ ├── Pods-BAButton_Example.modulemap │ └── Pods-BAButton_Example.release.xcconfig │ └── Pods-BAButton_Tests │ ├── Pods-BAButton_Tests-Info.plist │ ├── Pods-BAButton_Tests-acknowledgements.markdown │ ├── Pods-BAButton_Tests-acknowledgements.plist │ ├── Pods-BAButton_Tests-dummy.m │ ├── Pods-BAButton_Tests-umbrella.h │ ├── Pods-BAButton_Tests.debug.xcconfig │ ├── Pods-BAButton_Tests.modulemap │ └── Pods-BAButton_Tests.release.xcconfig ├── Images ├── BAButton.png ├── BAButton1.png ├── BAButton2.png └── BAButton3.png ├── LICENSE ├── LICENSE_CN ├── README.md └── _Pods.xcodeproj /._BAButton: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/._BAButton -------------------------------------------------------------------------------- /._BAButton.podspec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/._BAButton.podspec -------------------------------------------------------------------------------- /._BAButtonDemo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/._BAButtonDemo -------------------------------------------------------------------------------- /._LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/._LICENSE -------------------------------------------------------------------------------- /._README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/._README.md -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | # CocoaPods 34 | # 35 | # We recommend against adding the Pods directory to your .gitignore. However 36 | # you should judge for yourself, the pros and cons are mentioned at: 37 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 38 | # 39 | # Pods/ 40 | # 41 | # Add this line if you want to avoid checking in source code from the Xcode workspace 42 | # *.xcworkspace 43 | 44 | # Carthage 45 | # 46 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 47 | # Carthage/Checkouts 48 | 49 | Carthage/Build/ 50 | 51 | # fastlane 52 | # 53 | # It is recommended to not store the screenshots in the git repo. 54 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 55 | # For more information about the recommended setup visit: 56 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 57 | 58 | fastlane/report.xml 59 | fastlane/Preview.html 60 | fastlane/screenshots/**/*.png 61 | fastlane/test_output 62 | 63 | # Code Injection 64 | # 65 | # After new code Injection tools there's a generated folder /iOSInjectionProject 66 | # https://github.com/johnno1962/injectionforxcode 67 | 68 | iOSInjectionProject/ 69 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 3.0 2 | -------------------------------------------------------------------------------- /BAButton.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint BAButton.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'BAButton' 11 | s.version = '2.6.10' 12 | s.summary = '自定义 button 类!用分类全新重构 BAButton,代码配置更灵活!可以自由设置 button 的文字和图片的布局、间距、每个角的切圆角!' 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | 20 | s.description = <<-DESC 21 | 修复 BAKit_ButtonLayoutTypeRightImageRight 样式下文字显示不全问题,ba_padding_inset 默认改为0 22 | DESC 23 | 24 | s.homepage = 'https://github.com/BAHome/BAButton' 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 26 | s.license = { :type => 'https://github.com/996icu/996.ICU/blob/master/LICENSE', :file => 'LICENSE' } 27 | s.author = { 'boai' => 'sunboyan@outlook.com' } 28 | s.source = { :git => 'https://github.com/BAHome/BAButton.git', :tag => s.version.to_s } 29 | # s.social_media_url = 'https://twitter.com/' 30 | 31 | s.ios.deployment_target = '9.0' 32 | 33 | s.source_files = "BAButton/**/*.{h,m}" 34 | 35 | # s.resource_bundles = { 36 | # 'BAButton' => ['BAButton/Assets/*.png'] 37 | # } 38 | 39 | s.public_header_files = 'Pod/Classes/**/*.h' 40 | s.frameworks = 'UIKit', 'Foundation' 41 | s.requires_arc = true 42 | 43 | # s.dependency 'AFNetworking', '~> 2.3' 44 | end 45 | -------------------------------------------------------------------------------- /BAButton/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/BAButton/Assets/.gitkeep -------------------------------------------------------------------------------- /BAButton/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/BAButton/Classes/.gitkeep -------------------------------------------------------------------------------- /BAButton/Classes/BAButton/BAButton.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * BABaseProject 5 | * 6 | * @brief BAKit 7 | * 8 | * @author 博爱 9 | * @copyright Copyright © 2016年 博爱. All rights reserved. 10 | * @version V1.0 11 | */ 12 | 13 | // _ooOoo_ 14 | // o8888888o 15 | // 88" . "88 16 | // (| -_- |) 17 | // O\ = /O 18 | // ____/`---'\____ 19 | // . ' \\| |// `. 20 | // / \\||| : |||// \ 21 | // / _||||| -:- |||||- \ 22 | // | | \\\ - /// | | 23 | // | \_| ''\---/'' | | 24 | // \ .-\__ `-` ___/-. / 25 | // ___`. .' /--.--\ `. . __ 26 | // ."" '< `.___\_<|>_/___.' >'"". 27 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 28 | // \ \ `-. \_ __\ /__ _/ .-` / / 29 | // ======`-.____`-.___\_____/___.-`____.-'====== 30 | // `=---=' 31 | // 32 | // ............................................. 33 | // 佛祖镇楼 BUG辟易 34 | // 佛曰: 35 | // 写字楼里写字间,写字间里程序员; 36 | // 程序人员写程序,又拿程序换酒钱。 37 | // 酒醒只在网上坐,酒醉还来网下眠; 38 | // 酒醉酒醒日复日,网上网下年复年。 39 | // 但愿老死电脑间,不愿鞠躬老板前; 40 | // 奔驰宝马贵者趣,公交自行程序员。 41 | // 别人笑我忒疯癫,我笑自己命太贱; 42 | // 不见满街漂亮妹,哪个归得程序员? 43 | 44 | /* 45 | 46 | ********************************************************************************* 47 | * 48 | * 在使用BAKit的过程中如果出现bug请及时以以下任意一种方式联系我,我会及时修复bug 49 | * 50 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 51 | * 微博 : 博爱1616 52 | * Email : 137361770@qq.com 53 | * GitHub : https://github.com/boai 54 | * 博客 : http://boaihome.com 55 | 56 | ********************************************************************************* 57 | 58 | */ 59 | 60 | 61 | #ifndef BAButton_h 62 | #define BAButton_h 63 | 64 | #import 65 | #import 66 | 67 | #import "UIButton+BAKit.h" 68 | #import "UIButton+BAState.h" 69 | #import "UIButton+BACountDown.h" 70 | #import "UIView+BARectCorner.h" 71 | #import "BAKit_ConfigurationDefine.h" 72 | 73 | #endif /* BAButton_h */ 74 | -------------------------------------------------------------------------------- /BAButton/Classes/BAButton/BAButton_Version.h: -------------------------------------------------------------------------------- 1 | // 2 | // BAButton_Version.h 3 | // BAButton 4 | // 5 | // Created by 孙博岩 on 2018/8/28. 6 | // Copyright © 2018 boai. All rights reserved. 7 | // 8 | 9 | #ifndef BAButton_Version_h 10 | #define BAButton_Version_h 11 | 12 | 13 | /*! 14 | ********************************************************************************* 15 | ************************************ 更新说明 ************************************ 16 | ********************************************************************************* 17 | 18 | 欢迎使用 BAHome 系列开源代码 ! 19 | 如有更多需求,请前往:https://github.com/BAHome 20 | 21 | 项目源码地址: 22 | OC 版 :https://github.com/BAHome/BAButton 23 | 24 | 最新更新时间:2021-04-28【倒叙】
25 | 最新 Version:【Version:2.6.10】
26 | 更新内容:
27 | 2.6.10.1、修复 BAKit_ButtonLayoutTypeRightImageRight 样式下文字显示不全问题,ba_padding_inset 默认改为0
28 | 2.6.10.2、优化代码规范!
29 | 30 | 最新更新时间:2021-03-23【倒叙】
31 | 最新 Version:【Version:2.6.9】
32 | 更新内容:
33 | 2.6.9.1、`BAKit_ViewRectCornerType` 新增 `BAKit_ViewRectCornerTypeTopLeftAndBottomRight` 类型!
34 | 2.6.9.2、优化代码规范!
35 | 36 | 最新更新时间:2019-10-18【倒叙】
37 | 最新 Version:【Version:2.6.8】
38 | 更新内容:
39 | 2.6.8.1、修复 iPhone X 等异形屏 键盘异常问题!
40 | 2.6.8.2、优化代码规范!
41 | 42 | 最新更新时间:2018-11-15【倒叙】
43 | 最新 Version:【Version:2.6.7】
44 | 更新内容:
45 | 2.6.7.1、全新适配 官方 pod demo!
46 | 47 | 最新更新时间:2018-08-28【倒叙】
48 | 最新 Version:【Version:2.6.6】
49 | 更新内容:
50 | 2.6.6.1、优化内部代码,新增倒计时部分简化代码,详情看 demo 和源码!
51 | 52 | 最新更新时间:2017-09-15【倒叙】
53 | 最新 Version:【Version:2.6.5】
54 | 更新内容:
55 | 2.6.5.1、优化内部代码,修复隐形崩溃 bug!
56 | 57 | 最新更新时间:2017-09-12 【倒叙】
58 | 最新 Version:【Version:2.6.4】
59 | 更新内容:
60 | 2.6.4.1、新增 button 点击事件 blcok,具体使用详见 demo!
61 | 2.6.4.2、新增 button 不同状态下的阴影设置,具体使用详见 demo!
62 | 2.6.4.3、原 方法 【ba_viewPlaySoundEffectWithFileName】替换为:【ba_buttonPlaySoundEffectWithFileName】,具体使用详见 demo!
63 | 64 | 最新更新时间:2017-08-17 【倒叙】
65 | 最新 Version:【Version:2.6.3】
66 | 更新内容:
67 | 2.6.3.1、优化细节处理,新增 连续点击按钮时停止播放上一音乐
68 | 69 | 最新更新时间:2017-08-15 【倒叙】
70 | 最新 Version:【Version:2.6.2】
71 | 更新内容:
72 | 2.6.2.1、优化倒计时封装,线程处理优化
73 | 74 | 最新更新时间:2017-08-14 【倒叙】
75 | 最新 Version:【Version:2.6.1】
76 | 更新内容:
77 | 2.6.1.1、新增 倒计时按钮纯图片更换,详情请看 倒计时 demo
78 | 79 | 最新更新时间:2017-08-12 【倒叙】
80 | 最新 Version:【Version:2.6.0】
81 | 更新内容:
82 | 2.6.0.1、新增 按钮点击音效和震动效果封装
83 | 84 | 最新更新时间:2017-08-03 【倒叙】
85 | 最新Version:【Version:2.5.9】
86 | 更新内容:
87 | 2.5.9.1、修复 UIButton:快速创建 button4:frame、title、backgroundImage 方法死循环bug(感谢群里 [@杭州-秦小强 11:52:23](https://github.com/wqforeverhell) 同学提出的 bug!)
88 | 89 | 最新更新时间:2017-07-19 【倒叙】
90 | 最新Version:【Version:2.5.8】
91 | 更新内容:
92 | 2.5.8.1、新增 两种快速创建 button 的方法:1、快速创建纯文字 button,2、快速创建纯图片 button
93 | 2.5.8.2、新增 单独配置文字位置的封装
94 | 2.5.8.3、新增 字体颜色、背景颜色、image 等的 disabled 状态下的配置
95 | 96 | 最新更新时间:2017-07-08 【倒叙】
97 | 最新Version:【Version:2.5.6】
98 | 更新内容:
99 | 2.5.6.1、删除 高亮、选中 背景颜色,以免默认情况下回自动加高亮颜色
100 | 101 | 最新更新时间:2017-07-07 【倒叙】
102 | 最新Version:【Version:2.5.5】
103 | 更新内容:
104 | 2.5.5.1、重构 类,新增多种快速创建 button 的方法
105 | 2.5.5.2、新增多种快速创建 自定义 button 的方法
106 | 107 | 最新更新时间:2017-06-27 【倒叙】
108 | 最新Version:【Version:2.5.4】
109 | 更新内容:
110 | 2.5.4.1、新增 大图片 button 的 layout 布局,如果你的图片宽高大于 自身的宽高,则需要压缩后再配置布局,具体看 demo test2
111 | 112 | 最新更新时间:2017-06-23 【倒叙】 113 | 最新Version:【Version:2.5.3】 114 | 更新内容: 115 | 2.5.3.1、优化部分宏定义 116 | 117 | 最新更新时间:2017-06-23 【倒叙】 118 | 最新Version:【Version:2.5.2】 119 | 更新内容: 120 | 2.5.2.1、优化部分宏定义 121 | 122 | 最新更新时间:2017-06-20 【倒叙】
123 | 最新Version:【Version:2.5.1】
124 | 更新内容:
125 | 2.5.1.1、新增 view 的 border 的创建,可以自定义圆角、边框、边框颜色等(感谢群里 [@北京-大腿](http://www.jianshu.com/u/69939e049851) 同学提出的 需求!)
126 | 2.5.1.2、修复 xib 下圆角右边无效的bug,注意:如果是 xib,需要要有固定 宽高,要不然 iOS 10 设置无效(感谢群里 [@北京-小黑](https://github.com/baishitong) 同学提出的 bug!)
127 | 128 | 最新更新时间:2017-06-19 【倒叙】
129 | 最新Version:【Version:2.5.0】
130 | 更新内容:
131 | 2.5.0.1、优化命名规范,更换了全局统一属性命名和方法命名,如果更新有报错的地方,大家别急,看 .h 文件更换过来即可,后期推出的 BAKit 系列产品,命名都将统一规范,在此给大家带来的不便之处,向大家道歉!希望大家谅解!多谢体谅!
132 | 133 | 最新更新时间:2017-06-01 【倒叙】
134 | 最新Version:【Version:2.4.3】
135 | 更新内容:
136 | 2.4.3.1、快速创建 button 方法改为类方法,可直接调用!
137 | 138 | 最新更新时间:2017-06-01 【倒叙】 139 | 最新Version:【Version:2.4.2】 140 | 更新内容: 141 | 2.4.2.1、优化注释 142 | 143 | 最新更新时间:2017-06-01 【倒叙】 144 | 最新Version:【Version:2.4.1】 145 | 更新内容: 146 | 2.4.1.1、优化注释,注意:文字、字体大小、图片等设置一定要在设置 ba_button_setBAButtonLayoutType 之前设置,要不然计算会以默认字体大小计算,导致位置偏移 147 | 148 | 最新更新时间:2017-05-27 【倒叙】 149 | 最新Version:【Version:2.4.0】 150 | 更新内容: 151 | 2.4.0.1、此版本由 [子丰大神](https://github.com/renzifeng) 亲自改版,再次感谢 [子丰大神](https://github.com/renzifeng) 152 | 2.4.0.2、新增 UIButton 各种状态下背景颜色、字体、border、font、动画等的监测及改变 153 | 2.4.0.3、新增 UIButton 倒计时的封装,两行代码搞定倒计时! 154 | 2.4.0.4、优化整体代码结构,代码规范! 155 | 156 | 最新更新时间:2017-05-26 【倒叙】 157 | 最新Version:【Version:2.3.2】 158 | 更新内容: 159 | 2.3.2.1、优化代码结构,修复 frame 改变后 padding 无法更改的问题! 160 | 161 | 最新更新时间:2017-05-24 【倒叙】 162 | 最新Version:【Version:2.3.1】 163 | 更新内容: 164 | 2.3.1.1、新增:padding_inset,文字或图片距离 button 左右边界的最小距离,默认为:5 165 | 166 | 最新更新时间:2017-05-20 【倒叙】 167 | 最新Version:【Version:2.3.0】 168 | 更新内容: 169 | 2.3.0.1、用分类全新重构 BAButton,代码配置更灵活 170 | 2.3.0.2、可以自由设置 button 的文字和图片的布局、间距、每个角的切圆角 171 | 2.3.0.3、全面适配 纯代码、xib、storyboard 172 | 2.3.0.4、版本改动较大,希望大家谅解,如果用老版本的 BAButton,可以参考demo 更换新版本,后期改动不大 173 | 174 | */ 175 | 176 | #endif /* BAButton_Version_h */ 177 | -------------------------------------------------------------------------------- /BAButton/Classes/BAButton/BAKit_ConfigurationDefine.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * 5 | * @brief BAKit 6 | * 7 | * @author 博爱 8 | * @copyright Copyright © 2016年 博爱. All rights reserved. 9 | * @version V1.0 10 | */ 11 | 12 | // _ooOoo_ 13 | // o8888888o 14 | // 88" . "88 15 | // (| -_- |) 16 | // O\ = /O 17 | // ____/`---'\____ 18 | // . ' \\| |// `. 19 | // / \\||| : |||// \ 20 | // / _||||| -:- |||||- \ 21 | // | | \\\ - /// | | 22 | // | \_| ''\---/'' | | 23 | // \ .-\__ `-` ___/-. / 24 | // ___`. .' /--.--\ `. . __ 25 | // ."" '< `.___\_<|>_/___.' >'"". 26 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 27 | // \ \ `-. \_ __\ /__ _/ .-` / / 28 | // ======`-.____`-.___\_____/___.-`____.-'====== 29 | // `=---=' 30 | // 31 | // ............................................. 32 | // 佛祖镇楼 BUG辟易 33 | // 佛曰: 34 | // 写字楼里写字间,写字间里程序员; 35 | // 程序人员写程序,又拿程序换酒钱。 36 | // 酒醒只在网上坐,酒醉还来网下眠; 37 | // 酒醉酒醒日复日,网上网下年复年。 38 | // 但愿老死电脑间,不愿鞠躬老板前; 39 | // 奔驰宝马贵者趣,公交自行程序员。 40 | // 别人笑我忒疯癫,我笑自己命太贱; 41 | // 不见满街漂亮妹,哪个归得程序员? 42 | 43 | /* 44 | 45 | ********************************************************************************* 46 | * 47 | * 在使用 BAKit 的过程中如果出现 bug 请及时以以下任意一种方式联系我,我会及时修复 bug 48 | * 49 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 50 | * 微博 : 博爱1616 51 | * Email : 137361770@qq.com 52 | * GitHub : https://github.com/boai 53 | * BAHome : https://github.com/BAHome 54 | * 博客 : http://boaihome.com 55 | 56 | ********************************************************************************* 57 | 58 | */ 59 | 60 | 61 | #ifndef BAKit_ConfigurationDefine_h 62 | #define BAKit_ConfigurationDefine_h 63 | 64 | /** 65 | * Status bar height. 66 | */ 67 | #define kStatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height 68 | 69 | /** 70 | * Navigation bar height. 71 | */ 72 | #define kNavigationBarHeight 44.0 73 | 74 | /** 75 | * Status bar & navigation bar height. 76 | */ 77 | #define kStatusBarAndNavigationBarHeight (kStatusBarHeight + kNavigationBarHeight) 78 | 79 | #pragma mark - weak / strong 80 | #define BAKit_WeakSelf @BAKit_Weakify(self); 81 | #define BAKit_StrongSelf @BAKit_Strongify(self); 82 | 83 | /*! 84 | * 强弱引用转换,用于解决代码块(block)与强引用self之间的循环引用问题 85 | * 调用方式: `@BAKit_Weakify`实现弱引用转换,`@BAKit_Strongify`实现强引用转换 86 | * 87 | * 示例: 88 | * @BAKit_Weakify 89 | * [obj block:^{ 90 | * @strongify_self 91 | * self.property = something; 92 | * }]; 93 | */ 94 | #ifndef BAKit_Weakify 95 | #if DEBUG 96 | #if __has_feature(objc_arc) 97 | #define BAKit_Weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object; 98 | #else 99 | #define BAKit_Weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object; 100 | #endif 101 | #else 102 | #if __has_feature(objc_arc) 103 | #define BAKit_Weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object; 104 | #else 105 | #define BAKit_Weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object; 106 | #endif 107 | #endif 108 | #endif 109 | 110 | /*! 111 | * 强弱引用转换,用于解决代码块(block)与强引用对象之间的循环引用问题 112 | * 调用方式: `@BAKit_Weakify(object)`实现弱引用转换,`@BAKit_Strongify(object)`实现强引用转换 113 | * 114 | * 示例: 115 | * @BAKit_Weakify(object) 116 | * [obj block:^{ 117 | * @BAKit_Strongify(object) 118 | * strong_object = something; 119 | * }]; 120 | */ 121 | #ifndef BAKit_Strongify 122 | #if DEBUG 123 | #if __has_feature(objc_arc) 124 | #define BAKit_Strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object; 125 | #else 126 | #define BAKit_Strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object; 127 | #endif 128 | #else 129 | #if __has_feature(objc_arc) 130 | #define BAKit_Strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object; 131 | #else 132 | #define BAKit_Strongify(object) try{} @finally{} __typeof__(object) object = block##_##object; 133 | #endif 134 | #endif 135 | #endif 136 | 137 | /*! 获取sharedApplication */ 138 | #define BAKit_SharedApplication [UIApplication sharedApplication] 139 | 140 | // 操作系统版本号 141 | #define BAKit_IOS_VERSION ([[[UIDevice currentDevice] systemVersion] floatValue]) 142 | 143 | /*! 主线程同步队列 */ 144 | #define dispatch_main_sync_safe(block)\ 145 | if ([NSThread isMainThread]) {\ 146 | block();\ 147 | } else {\ 148 | dispatch_sync(dispatch_get_main_queue(), block);\ 149 | } 150 | /*! 主线程异步队列 */ 151 | #define dispatch_main_async_safe(block)\ 152 | if ([NSThread isMainThread]) {\ 153 | block();\ 154 | } else {\ 155 | dispatch_async(dispatch_get_main_queue(), block);\ 156 | } 157 | 158 | 159 | #pragma mark - runtime 160 | #import 161 | /*! runtime set */ 162 | #define BAKit_Objc_setObj(key, value) objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC) 163 | 164 | /*! runtime setCopy */ 165 | #define BAKit_Objc_setObjCOPY(key, value) objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_COPY) 166 | 167 | /*! runtime get */ 168 | #define BAKit_Objc_getObj objc_getAssociatedObject(self, _cmd) 169 | 170 | /*! runtime exchangeMethod */ 171 | #define BAKit_Objc_exchangeMethodAToB(originalSelector,swizzledSelector) { \ 172 | Method originalMethod = class_getInstanceMethod(self, originalSelector); \ 173 | Method swizzledMethod = class_getInstanceMethod(self, swizzledSelector); \ 174 | if (class_addMethod(self, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod))) { \ 175 | class_replaceMethod(self, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); \ 176 | } else { \ 177 | method_exchangeImplementations(originalMethod, swizzledMethod); \ 178 | } \ 179 | } 180 | 181 | #pragma mark - 简单警告框 182 | /*! view 用 BAKit_ShowAlertWithMsg */ 183 | #define BAKit_ShowAlertWithMsg(msg) [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:(msg) delegate:nil cancelButtonTitle:@"确 定" otherButtonTitles:nil] show]; 184 | /*! VC 用 BAKit_ShowAlertWithMsg */ 185 | #define BAKit_ShowAlertWithMsg_ios8(msg) UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:msg preferredStyle:UIAlertControllerStyleAlert];\ 186 | UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确 定" style:UIAlertActionStyleDefault handler:nil];\ 187 | [alert addAction:sureAction];\ 188 | [self presentViewController:alert animated:YES completion:nil]; 189 | 190 | #pragma mark - color 191 | CG_INLINE UIColor * 192 | BAKit_Color_RGBA_pod(u_char r,u_char g, u_char b, u_char a) { 193 | return [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]; 194 | } 195 | 196 | CG_INLINE UIColor * 197 | BAKit_Color_RGB_pod(u_char r,u_char g, u_char b) { 198 | return BAKit_Color_RGBA_pod(r, g, b, 1.0); 199 | } 200 | 201 | CG_INLINE UIColor * 202 | BAKit_Color_RGBValue_pod(UInt32 rgbValue){ 203 | return [UIColor colorWithRed:((rgbValue & 0xff0000) >> 16) / 255.0f 204 | green:((rgbValue & 0xff00) >> 8) / 255.0f 205 | blue:(rgbValue & 0xff) / 255.0f 206 | alpha:1.0f]; 207 | } 208 | 209 | CG_INLINE UIColor * 210 | BAKit_Color_RGBAValue_pod(UInt32 rgbaValue){ 211 | return [UIColor colorWithRed:((rgbaValue & 0xff000000) >> 24) / 255.0f 212 | green:((rgbaValue & 0xff0000) >> 16) / 255.0f 213 | blue:((rgbaValue & 0xff00) >> 8) / 255.0f 214 | alpha:(rgbaValue & 0xff) / 255.0f]; 215 | } 216 | 217 | CG_INLINE UIColor * 218 | BAKit_Color_RandomRGB_pod(){ 219 | return BAKit_Color_RGBValue_pod(arc4random_uniform(0xffffff)); 220 | } 221 | 222 | CG_INLINE UIColor * 223 | BAKit_Color_RandomRGBA_pod(){ 224 | return BAKit_Color_RGBAValue_pod(arc4random_uniform(0xffffffff)); 225 | } 226 | 227 | 228 | #define BAKit_Color_Translucent_pod [UIColor colorWithRed:0.3f green:0.3f blue:0.3f alpha:0.5f] 229 | #define BAKit_Color_White_pod [UIColor whiteColor] 230 | #define BAKit_Color_Clear_pod [UIColor clearColor] 231 | #define BAKit_Color_Black_pod [UIColor blackColor] 232 | #define BAKit_Color_White_pod [UIColor whiteColor] 233 | #define BAKit_Color_Red_pod [UIColor redColor] 234 | #define BAKit_Color_Green_pod [UIColor greenColor] 235 | #define BAKit_Color_Orange_pod [UIColor orangeColor] 236 | #define BAKit_Color_Yellow_pod [UIColor yellowColor] 237 | 238 | 239 | /*! 灰色 */ 240 | #define BAKit_Color_Gray_1_pod BAKit_Color_RGB_pod(53, 60, 70) 241 | #define BAKit_Color_Gray_2_pod BAKit_Color_RGB_pod(73, 80, 90) 242 | #define BAKit_Color_Gray_3_pod BAKit_Color_RGB_pod(93, 100, 110) 243 | #define BAKit_Color_Gray_4_pod BAKit_Color_RGB_pod(113, 120, 130) 244 | #define BAKit_Color_Gray_5_pod BAKit_Color_RGB_pod(133, 140, 150) 245 | #define BAKit_Color_Gray_6_pod BAKit_Color_RGB_pod(153, 160, 170) 246 | #define BAKit_Color_Gray_7_pod BAKit_Color_RGB_pod(173, 180, 190) 247 | #define BAKit_Color_Gray_8_pod BAKit_Color_RGB_pod(196, 200, 208) 248 | #define BAKit_Color_Gray_9_pod BAKit_Color_RGB_pod(216, 220, 228) 249 | #define BAKit_Color_Gray_10_pod BAKit_Color_RGB_pod(240, 240, 240) 250 | #define BAKit_Color_Gray_11_pod BAKit_Color_RGB_pod(248, 248, 248) 251 | 252 | #pragma mark - Margin 253 | #define BAKit_Margin_1_pod BAKit_Flat_pod(1) 254 | #define BAKit_Margin_2_pod BAKit_Flat_pod(2) 255 | #define BAKit_Margin_5_pod BAKit_Flat_pod(5) 256 | #define BAKit_Margin_10_pod BAKit_Flat_pod(10) 257 | #define BAKit_Margin_15_pod BAKit_Flat_pod(15) 258 | #define BAKit_Margin_20_pod BAKit_Flat_pod(20) 259 | #define BAKit_Margin_25_pod BAKit_Flat_pod(25) 260 | #define BAKit_Margin_30_pod BAKit_Flat_pod(30) 261 | #define BAKit_Margin_35_pod BAKit_Flat_pod(35) 262 | #define BAKit_Margin_40_pod BAKit_Flat_pod(40) 263 | #define BAKit_Margin_44_pod BAKit_Flat_pod(44) 264 | #define BAKit_Margin_50_pod BAKit_Flat_pod(50) 265 | #define BAKit_Margin_100_pod BAKit_Flat_pod(100) 266 | #define BAKit_Margin_150_pod BAKit_Flat_pod(150) 267 | 268 | 269 | #define BAKit_ImageName(imageName) [UIImage imageNamed:imageName] 270 | 271 | #pragma mark - NotiCenter other 272 | #define BAKit_NotiCenter [NSNotificationCenter defaultCenter] 273 | 274 | #define BAKit_NSUserDefaults [NSUserDefaults standardUserDefaults] 275 | 276 | /*! 获取sharedApplication */ 277 | #define BAKit_SharedApplication [UIApplication sharedApplication] 278 | 279 | /*! 用safari打开URL */ 280 | #define BAKit_OpenUrl(urlStr) [BAKit_SharedApplication openURL:[NSURL URLWithString:urlStr]] 281 | 282 | /*! 复制文字内容 */ 283 | #define BAKit_CopyContent(content) [[UIPasteboard generalPasteboard] setString:content] 284 | 285 | 286 | /*! 287 | * 获取屏幕宽度和高度 288 | */ 289 | #define BAKit_SCREEN_WIDTH ((([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait) || ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown)) ? [[UIScreen mainScreen] bounds].size.width : [[UIScreen mainScreen] bounds].size.height) 290 | 291 | #define BAKit_SCREEN_HEIGHT ((([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait) || ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown)) ? [[UIScreen mainScreen] bounds].size.height : [[UIScreen mainScreen] bounds].size.width) 292 | 293 | #define BAKit_BaseScreenWidth 320.0f 294 | #define BAKit_BaseScreenHeight 568.0f 295 | 296 | /*! 屏幕适配(5S标准屏幕:320 * 568) */ 297 | // iPhone 7 屏幕:375 * 667 298 | //376/320 = 299 | //667/568 = 300 | #define BAKit_ScaleXAndWidth BAKit_SCREEN_WIDTH/BAKit_BaseScreenWidth 301 | #define BAKit_ScaleYAndHeight BAKit_SCREEN_HEIGHT/BAKit_BaseScreenHeight 302 | 303 | #define BAKit_ScreenScale ([[UIScreen mainScreen] scale]) 304 | 305 | CG_INLINE BOOL 306 | BAKit_stringIsBlank_pod(NSString *string) { 307 | NSCharacterSet *blank = [NSCharacterSet whitespaceAndNewlineCharacterSet]; 308 | for (NSInteger i = 0; i < string.length; ++i) { 309 | unichar c = [string characterAtIndex:i]; 310 | if (![blank characterIsMember:c]) { 311 | return NO; 312 | } 313 | } 314 | return YES; 315 | } 316 | 317 | /** 318 | * 基于指定的倍数,对传进来的 floatValue 进行像素取整。若指定倍数为0,则表示以当前设备的屏幕倍数为准。 319 | * 320 | * 例如传进来 “2.1”,在 2x 倍数下会返回 2.5(0.5pt 对应 1px),在 3x 倍数下会返回 2.333(0.333pt 对应 1px)。 321 | */ 322 | CG_INLINE CGFloat 323 | BAKit_FlatSpecificScale_pod(CGFloat floatValue, CGFloat scale) { 324 | scale = scale == 0 ? BAKit_ScreenScale : scale; 325 | CGFloat flattedValue = ceil(floatValue * scale) / scale; 326 | return flattedValue; 327 | } 328 | 329 | /** 330 | * 基于当前设备的屏幕倍数,对传进来的 floatValue 进行像素取整。 331 | * 332 | * 注意如果在 Core Graphic 绘图里使用时,要注意当前画布的倍数是否和设备屏幕倍数一致,若不一致,不可使用 flat() 函数,而应该用 flatSpecificScale 333 | */ 334 | CG_INLINE CGFloat 335 | BAKit_Flat_pod(CGFloat floatValue) { 336 | return BAKit_FlatSpecificScale_pod(floatValue, 0); 337 | } 338 | 339 | /// 将一个CGSize像素对齐 340 | CG_INLINE CGSize 341 | BAKit_CGSizeFlatted_pod(CGSize size) { 342 | return CGSizeMake(BAKit_Flat_pod(size.width), BAKit_Flat_pod(size.height)); 343 | } 344 | 345 | /// 创建一个像素对齐的CGRect 346 | CG_INLINE CGRect 347 | BAKit_CGRectFlatMake_pod(CGFloat x, CGFloat y, CGFloat width, CGFloat height) { 348 | return CGRectMake(BAKit_Flat_pod(x), BAKit_Flat_pod(y), BAKit_Flat_pod(width), BAKit_Flat_pod(height)); 349 | } 350 | 351 | /** 352 | 计算列数【根据 array.count、每行多少个 item,计算列数】 353 | 354 | @param array array 355 | @param rowCount 每行多少个 item 356 | @return 列数 357 | */ 358 | CG_INLINE NSInteger 359 | BAKit_getColumnCountWithArrayAndRowCount_pod(NSArray *array, NSInteger rowCount){ 360 | NSUInteger count = array.count; 361 | 362 | NSUInteger i = 0; 363 | if (count % rowCount == 0) { 364 | i = count / rowCount; 365 | } else { 366 | i = count / rowCount + 1; 367 | } 368 | return i; 369 | } 370 | 371 | 372 | #endif /* BAKit_ConfigurationDefine_h */ 373 | -------------------------------------------------------------------------------- /BAButton/Classes/BAButton/UIButton+BACountDown.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+BACountDown.h 3 | // BAButton 4 | // 5 | // Created by 任子丰 on 16/6/17. 6 | // Copyright © 2016年 任子丰. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void (^BAKit_BAButtonCountDownBlock)(NSInteger currentTime); 12 | 13 | @interface UIButton (BACountDown) 14 | 15 | @property (nonatomic, copy) void(^timeStoppedCallback)(void); 16 | 17 | /** 18 | 倒计时: 一行代码快速使用 19 | 20 | @param duration 倒计时时间 21 | @param format 可选,传nil默认为 @"%zd秒" 22 | @param title 结束后显示文字 23 | */ 24 | - (void)ba_countDownWithTimeInterval:(NSTimeInterval)duration 25 | countDownFormat:(NSString *)format 26 | endTitle:(NSString *)title; 27 | 28 | /** 29 | 倒计时:带 title,返回时间,title,具体使用看 demo 30 | 31 | @param duration 倒计时时间 32 | @param format 可选,传nil默认为 @"%zd秒" 33 | */ 34 | - (void)ba_countDownWithTimeInterval:(NSTimeInterval)duration 35 | countDownFormat:(NSString *)format; 36 | 37 | /** 38 | 倒计时:返回当前时间,可以自定义 title 和 image,具体使用看 demo 39 | 40 | @param duration 倒计时时间 41 | @param block 返回当前时间 42 | */ 43 | - (void)ba_countDownCustomWithTimeInterval:(NSTimeInterval)duration 44 | block:(BAKit_BAButtonCountDownBlock)block; 45 | 46 | /** 47 | * 倒计时:结束,取消倒计时 48 | */ 49 | - (void)ba_cancelTimer; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /BAButton/Classes/BAButton/UIButton+BACountDown.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+BACountDown.m 3 | // BAButton 4 | // 5 | // Created by 任子丰 on 16/6/17. 6 | // Copyright © 2016年 任子丰. All rights reserved. 7 | // 8 | 9 | #import "UIButton+BACountDown.h" 10 | #import "BAKit_ConfigurationDefine.h" 11 | #import 12 | 13 | @interface UIButton () 14 | 15 | @property (nonatomic, assign) NSTimeInterval leaveTime; 16 | @property (nonatomic, copy) NSString *normalTitle; 17 | @property (nonatomic, copy) NSString *countDownFormat; 18 | @property (nonatomic, strong) dispatch_source_t timer; 19 | 20 | @end 21 | 22 | @implementation UIButton (BACountDown) 23 | 24 | - (void)setTimer:(dispatch_source_t)timer { 25 | BAKit_Objc_setObj(@selector(timer), timer); 26 | } 27 | 28 | - (dispatch_source_t)timer { 29 | return BAKit_Objc_getObj; 30 | } 31 | 32 | - (void)setLeaveTime:(NSTimeInterval)leaveTime { 33 | BAKit_Objc_setObj(@selector(leaveTime), @(leaveTime)); 34 | } 35 | 36 | - (NSTimeInterval)leaveTime { 37 | return [BAKit_Objc_getObj doubleValue]; 38 | } 39 | 40 | - (void)setCountDownFormat:(NSString *)countDownFormat { 41 | BAKit_Objc_setObjCOPY(@selector(countDownFormat), countDownFormat); 42 | } 43 | 44 | - (NSString *)countDownFormat { 45 | return BAKit_Objc_getObj; 46 | } 47 | 48 | - (void)setTimeStoppedCallback:(void (^)(void))timeStoppedCallback { 49 | BAKit_Objc_setObjCOPY(@selector(timeStoppedCallback), timeStoppedCallback); 50 | } 51 | 52 | - (void (^)(void))timeStoppedCallback { 53 | return BAKit_Objc_getObj; 54 | } 55 | 56 | - (void)setNormalTitle:(NSString *)normalTitle { 57 | BAKit_Objc_setObjCOPY(@selector(normalTitle), normalTitle); 58 | } 59 | 60 | - (NSString *)normalTitle { 61 | return BAKit_Objc_getObj; 62 | } 63 | 64 | #pragma mark - public 65 | /** 66 | 倒计时:带 title,返回时间,title,具体使用看 demo 67 | 68 | @param duration 倒计时时间 69 | @param format 可选,传nil默认为 @"%zd秒" 70 | @param title 结束后显示文字 71 | */ 72 | - (void)ba_countDownWithTimeInterval:(NSTimeInterval)duration 73 | countDownFormat:(NSString *)format 74 | endTitle:(NSString *)title { 75 | if (!format) { 76 | self.countDownFormat = @"%zd秒"; 77 | } else { 78 | self.countDownFormat = format; 79 | } 80 | self.normalTitle = self.titleLabel.text; 81 | __block NSInteger timeOut = duration; //倒计时时间 82 | dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 83 | self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,queue); 84 | dispatch_source_set_timer(self.timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //每秒执行 85 | BAKit_WeakSelf 86 | dispatch_source_set_event_handler(self.timer, ^{ 87 | BAKit_StrongSelf 88 | dispatch_async(dispatch_get_main_queue(), ^{ 89 | if (timeOut <= 0) { // 倒计时结束,关闭 90 | self.userInteractionEnabled = YES; 91 | [self setTitle:title forState:UIControlStateNormal]; 92 | } else { 93 | self.userInteractionEnabled = NO; 94 | NSString *title = [NSString stringWithFormat:self.countDownFormat, timeOut]; 95 | [self setTitle:title forState:UIControlStateNormal]; 96 | timeOut--; 97 | } 98 | }); 99 | }); 100 | dispatch_resume(self.timer); 101 | } 102 | 103 | /** 104 | 倒计时:带 title,返回时间,title,具体使用看 demo 105 | 106 | @param duration 倒计时时间 107 | @param format 可选,传nil默认为 @"%zd秒" 108 | */ 109 | - (void)ba_countDownWithTimeInterval:(NSTimeInterval)duration 110 | countDownFormat:(NSString *)format { 111 | if (!format) { 112 | self.countDownFormat = @"%zd秒"; 113 | } else { 114 | self.countDownFormat = format; 115 | } 116 | self.normalTitle = self.titleLabel.text; 117 | __block NSInteger timeOut = duration; //倒计时时间 118 | dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 119 | self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,queue); 120 | dispatch_source_set_timer(self.timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //每秒执行 121 | BAKit_WeakSelf 122 | dispatch_source_set_event_handler(self.timer, ^{ 123 | BAKit_StrongSelf 124 | dispatch_async(dispatch_get_main_queue(), ^{ 125 | if (timeOut <= 0) { // 倒计时结束,关闭 126 | [self ba_cancelTimer]; 127 | } else { 128 | NSString *title = [NSString stringWithFormat:self.countDownFormat, timeOut]; 129 | [self setTitle:title forState:UIControlStateNormal]; 130 | timeOut--; 131 | } 132 | }); 133 | }); 134 | dispatch_resume(self.timer); 135 | } 136 | 137 | /** 138 | 倒计时:返回当前时间,可以自定义 title 和 image,具体使用看 demo 139 | 140 | @param duration 倒计时时间 141 | @param block 返回当前时间 142 | */ 143 | - (void)ba_countDownCustomWithTimeInterval:(NSTimeInterval)duration 144 | block:(BAKit_BAButtonCountDownBlock)block { 145 | __block NSInteger timeOut = duration; //倒计时时间 146 | dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 147 | self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,queue); 148 | dispatch_source_set_timer(self.timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //每秒执行 149 | BAKit_WeakSelf 150 | dispatch_source_set_event_handler(self.timer, ^{ 151 | BAKit_StrongSelf 152 | dispatch_async(dispatch_get_main_queue(), ^{ 153 | if (block) { 154 | block(timeOut); 155 | } 156 | if (timeOut <= 0) { 157 | // 倒计时结束,关闭 158 | [self ba_cancelTimer]; 159 | } 160 | else { 161 | timeOut--; 162 | } 163 | }); 164 | 165 | }); 166 | dispatch_resume(self.timer); 167 | } 168 | 169 | /** 170 | * 倒计时:结束,取消倒计时 171 | */ 172 | - (void)ba_cancelTimer { 173 | if (!self.timer) { 174 | return; 175 | } 176 | BAKit_WeakSelf 177 | dispatch_async(dispatch_get_main_queue(), ^{ 178 | BAKit_StrongSelf 179 | dispatch_source_cancel(self.timer); 180 | self.timer = nil; 181 | 182 | // 设置界面的按钮显示 根据自己需求设置 183 | [self setTitle:self.normalTitle forState:UIControlStateNormal]; 184 | self.userInteractionEnabled = YES; 185 | if (self.timeStoppedCallback) { self.timeStoppedCallback(); } 186 | }); 187 | } 188 | 189 | @end 190 | -------------------------------------------------------------------------------- /BAButton/Classes/BAButton/UIButton+BAKit.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * BABaseProject 5 | * 6 | * @brief BAKit 7 | * 8 | * @author 博爱 9 | * @copyright Copyright © 2016年 博爱. All rights reserved. 10 | * @version V1.0 11 | */ 12 | 13 | // _ooOoo_ 14 | // o8888888o 15 | // 88" . "88 16 | // (| -_- |) 17 | // O\ = /O 18 | // ____/`---'\____ 19 | // . ' \\| |// `. 20 | // / \\||| : |||// \ 21 | // / _||||| -:- |||||- \ 22 | // | | \\\ - /// | | 23 | // | \_| ''\---/'' | | 24 | // \ .-\__ `-` ___/-. / 25 | // ___`. .' /--.--\ `. . __ 26 | // ."" '< `.___\_<|>_/___.' >'"". 27 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 28 | // \ \ `-. \_ __\ /__ _/ .-` / / 29 | // ======`-.____`-.___\_____/___.-`____.-'====== 30 | // `=---=' 31 | // 32 | // ............................................. 33 | // 佛祖镇楼 BUG辟易 34 | // 佛曰: 35 | // 写字楼里写字间,写字间里程序员; 36 | // 程序人员写程序,又拿程序换酒钱。 37 | // 酒醒只在网上坐,酒醉还来网下眠; 38 | // 酒醉酒醒日复日,网上网下年复年。 39 | // 但愿老死电脑间,不愿鞠躬老板前; 40 | // 奔驰宝马贵者趣,公交自行程序员。 41 | // 别人笑我忒疯癫,我笑自己命太贱; 42 | // 不见满街漂亮妹,哪个归得程序员? 43 | 44 | /* 45 | 46 | ********************************************************************************* 47 | * 48 | * 在使用BAKit的过程中如果出现bug请及时以以下任意一种方式联系我,我会及时修复bug 49 | * 50 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 51 | * 微博 : 博爱1616 52 | * Email : 137361770@qq.com 53 | * GitHub : https://github.com/boai 54 | * 博客 : http://boaihome.com 55 | 56 | ********************************************************************************* 57 | 58 | */ 59 | 60 | 61 | #import 62 | #import "UIView+BARectCorner.h" 63 | 64 | NS_ASSUME_NONNULL_BEGIN 65 | /** 66 | button 的样式,以图片为基准 67 | 68 | - BAKit_ButtonLayoutTypeNormal: button 默认样式:内容居中-图左文右 69 | - BAKit_ButtonLayoutTypeCenterImageRight: 内容居中-图右文左 70 | - BAKit_ButtonLayoutTypeCenterImageTop: 内容居中-图上文下 71 | - BAKit_ButtonLayoutTypeCenterImageBottom: 内容居中-图下文上 72 | - BAKit_ButtonLayoutTypeLeftImageLeft: 内容居左-图左文右 73 | - BAKit_ButtonLayoutTypeLeftImageRight: 内容居左-图右文左 74 | - BAKit_ButtonLayoutTypeRightImageLeft: 内容居右-图左文右 75 | - BAKit_ButtonLayoutTypeRightImageRight: 内容居右-图右文左 76 | */ 77 | typedef NS_ENUM(NSInteger, BAKit_ButtonLayoutType) { 78 | // 无任何处理 79 | BAKit_ButtonLayoutTypeDefault = 0, 80 | // 系统默认样式 81 | BAKit_ButtonLayoutTypeNormal, 82 | BAKit_ButtonLayoutTypeCenterImageRight, 83 | BAKit_ButtonLayoutTypeCenterImageTop, 84 | BAKit_ButtonLayoutTypeCenterImageBottom, 85 | BAKit_ButtonLayoutTypeLeftImageLeft, 86 | BAKit_ButtonLayoutTypeLeftImageRight, 87 | BAKit_ButtonLayoutTypeRightImageLeft, 88 | BAKit_ButtonLayoutTypeRightImageRight, 89 | }; 90 | 91 | /** 92 | UIButton:点击事件 block 返回 93 | 94 | @param button 当前的 button 95 | */ 96 | typedef void (^BAKit_UIButtonActionBlock)(UIButton * _Nonnull button); 97 | 98 | @interface UIButton (BAKit) 99 | 100 | /** 101 | button 的布局样式,默认为:BAKit_ButtonLayoutTypeNormal,注意:文字、字体大小、图片等设置一定要在设置 ba_button_setBAKit_ButtonLayoutType 之前设置,要不然计算会以默认字体大小计算,导致位置偏移 102 | */ 103 | @property(nonatomic, assign) BAKit_ButtonLayoutType ba_buttonLayoutType; 104 | 105 | /*! 106 | * 文字与图片之间的间距,默认为:0 107 | */ 108 | @property (nonatomic, assign) CGFloat ba_padding; 109 | 110 | /*! 111 | * 文字或图片距离 button 左右边界的最小距离,默认为:0 112 | */ 113 | @property (nonatomic, assign) CGFloat ba_padding_inset; 114 | 115 | /** 116 | UIButton:点击事件 block 返回 117 | */ 118 | @property(nonatomic, copy) BAKit_UIButtonActionBlock ba_buttonActionBlock; 119 | 120 | #pragma mark - 快速创建 button 121 | 122 | /** 123 | UIButton:快速创建 button1:frame、title、titleColor、titleFont 124 | 125 | @param frame frame 126 | @param title title 127 | @param titleColor titleColor 128 | @param titleFont titleFont 129 | @return button 130 | */ 131 | + (id)ba_buttonWithFrame:(CGRect)frame 132 | title:(NSString * __nullable)title 133 | titleColor:(UIColor * __nullable)titleColor 134 | titleFont:(UIFont * __nullable)titleFont; 135 | 136 | /** 137 | UIButton:快速创建 button2:frame、title、backgroundColor 138 | 139 | @param frame frame 140 | @param title title 141 | @param backgroundColor backgroundColor 142 | @return button 143 | */ 144 | + (id)ba_buttonWithFrame:(CGRect)frame 145 | title:(NSString * __nullable)title 146 | backgroundColor:(UIColor * __nullable)backgroundColor; 147 | 148 | /** 149 | UIButton:快速创建 button3:frame、title、titleColor、titleFont、backgroundColor 150 | 151 | @param frame frame 152 | @param title title 153 | @param titleColor titleColor 154 | @param titleFont titleFont 155 | @param backgroundColor backgroundColor 156 | @return button 157 | */ 158 | + (id)ba_buttonWithFrame:(CGRect)frame 159 | title:(NSString * __nullable)title 160 | titleColor:(UIColor * __nullable)titleColor 161 | titleFont:(UIFont * __nullable)titleFont 162 | backgroundColor:(UIColor * __nullable)backgroundColor; 163 | 164 | /** 165 | UIButton:快速创建 button4:frame、title、backgroundImage 166 | 167 | @param frame frame 168 | @param title title 169 | @param backgroundImage backgroundImage 170 | @return button 171 | */ 172 | + (id)ba_buttonWithFrame:(CGRect)frame 173 | title:(NSString * __nullable)title 174 | backgroundImage:(UIImage * __nullable)backgroundImage; 175 | 176 | /** 177 | UIButton:快速创建 button5:frame、title、titleColor、titleFont、image、backgroundColor 178 | 179 | @param frame frame description 180 | @param title title description 181 | @param titleColor titleColor description 182 | @param titleFont titleFont description 183 | @param image image description 184 | @param backgroundColor backgroundColor description 185 | @return button 186 | */ 187 | + (instancetype)ba_buttonWithFrame:(CGRect)frame 188 | title:(NSString * __nullable)title 189 | titleColor:(UIColor * __nullable)titleColor 190 | titleFont:(UIFont * __nullable)titleFont 191 | image:(UIImage * __nullable)image 192 | backgroundColor:(UIColor * __nullable)backgroundColor; 193 | 194 | /** 195 | UIButton:快速创建 button6:frame、title、titleColor、titleFont、image、backgroundImage 196 | 197 | @param frame frame description 198 | @param title title description 199 | @param titleColor titleColor description 200 | @param titleFont titleFont description 201 | @param image image description 202 | @param backgroundImage backgroundImage description 203 | @return button 204 | */ 205 | + (instancetype)ba_buttonWithFrame:(CGRect)frame 206 | title:(NSString * __nullable)title 207 | titleColor:(UIColor * __nullable)titleColor 208 | titleFont:(UIFont * __nullable)titleFont 209 | image:(UIImage * __nullable)image 210 | backgroundImage:(UIImage * __nullable)backgroundImage; 211 | 212 | /** 213 | UIButton:快速创建 button7:大汇总-点击事件、圆角 214 | 215 | @param frame frame 216 | @param title title 217 | @param selTitle selTitle 218 | @param titleColor titleColor,默认:黑色 219 | @param titleFont titleFont默认:15 220 | @param image image description 221 | @param selImage selImage 222 | @param padding padding 文字图片间距 223 | @param buttonLayoutType buttonLayoutType 文字图片布局样式 224 | @param viewRectCornerType viewRectCornerType 圆角样式 225 | @param viewCornerRadius viewCornerRadius 圆角角度 226 | @param target target 227 | @param sel sel 228 | @return button 229 | */ 230 | + (instancetype __nonnull)ba_creatButtonWithFrame:(CGRect)frame 231 | title:(NSString * __nullable)title 232 | selTitle:(NSString * __nullable)selTitle 233 | titleColor:(UIColor * __nullable)titleColor 234 | titleFont:(UIFont * __nullable)titleFont 235 | image:(UIImage * __nullable)image 236 | selImage:(UIImage * __nullable)selImage 237 | padding:(CGFloat)padding 238 | buttonPositionStyle:(BAKit_ButtonLayoutType)buttonLayoutType 239 | viewRectCornerType:(BAKit_ViewRectCornerType)viewRectCornerType 240 | viewCornerRadius:(CGFloat)viewCornerRadius 241 | target:(id __nullable)target 242 | selector:(SEL __nullable)sel; 243 | 244 | /** 245 | UIButton:快速创建 button8:大汇总-所有 normal、selected、highlighted 样式都有 246 | 247 | @param frame frame 248 | @param title title description 249 | @param selectedTitle selectedTitle description 250 | @param highlightedTitle highlightedTitle description 251 | @param titleColor titleColor description 252 | @param selectedTitleColor selectedTitleColor description 253 | @param highlightedTitleColor highlightedTitleColor description 254 | @param titleFont titleFont description 255 | @param image image description 256 | @param selectedImage selectedImage description 257 | @param highlightedImage highlightedImage description 258 | @param backgroundImage backgroundImage description 259 | @param selectedBackgroundImage selectedBackgroundImage description 260 | @param highlightedBackgroundImage highlightedBackgroundImage description 261 | @param backgroundColor backgroundColor description 262 | @return button 263 | */ 264 | + (instancetype)ba_buttonWithFrame:(CGRect)frame 265 | title:(NSString * __nullable)title 266 | selectedTitle:(NSString * __nullable)selectedTitle 267 | highlightedTitle:(NSString * __nullable)highlightedTitle 268 | titleColor:(UIColor * __nullable)titleColor 269 | selectedTitleColor:(UIColor * __nullable)selectedTitleColor 270 | highlightedTitleColor:(UIColor * __nullable)highlightedTitleColor 271 | titleFont:(UIFont * __nullable)titleFont 272 | image:(UIImage * __nullable)image 273 | selectedImage:(UIImage * __nullable)selectedImage 274 | highlightedImage:(UIImage * __nullable)highlightedImage 275 | backgroundImage:(UIImage * __nullable)backgroundImage 276 | selectedBackgroundImage:(UIImage * __nullable)selectedBackgroundImage 277 | highlightedBackgroundImage:(UIImage * __nullable)highlightedBackgroundImage 278 | backgroundColor:(UIColor * __nullable)backgroundColor; 279 | 280 | /** 281 | UIButton:快速创建一个纯文字 button 282 | 283 | @param frame frame description 284 | @param title title description 285 | @param font font description 286 | @param horizontalAlignment horizontalAlignment description 287 | @param verticalAlignment verticalAlignment description 288 | @param contentEdgeInsets contentEdgeInsets description 289 | @param target target description 290 | @param action action description 291 | @param normalStateColor normalStateColor description 292 | @param highlightedStateColor highlightedStateColor description 293 | @param disabledStateColor disabledStateColor description 294 | @return UIButton 295 | */ 296 | + (UIButton *)ba_buttonLabelButtonWithFrame:(CGRect)frame 297 | title:(NSString *)title 298 | font:(UIFont *)font 299 | horizontalAlignment:(UIControlContentHorizontalAlignment)horizontalAlignment 300 | verticalAlignment:(UIControlContentVerticalAlignment)verticalAlignment 301 | contentEdgeInsets:(UIEdgeInsets)contentEdgeInsets 302 | target:(id)target 303 | action:(SEL)action 304 | normalTitleColor:(UIColor *)normalStateColor 305 | highlightedTitleColor:(UIColor *)highlightedStateColor 306 | disabledTitleColor:(UIColor *)disabledStateColor; 307 | 308 | /** 309 | UIButton:快速创建一个纯图片 button 310 | 311 | @param frame frame description 312 | @param horizontalAlignment horizontalAlignment description 313 | @param verticalAlignment verticalAlignment description 314 | @param contentEdgeInsets contentEdgeInsets description 315 | @param normalImage normalImage description 316 | @param highlightImage highlightImage description 317 | @param disabledImage disabledImage description 318 | @param target target description 319 | @param action action description 320 | @return UIButton 321 | */ 322 | + (UIButton *)ba_buttonImageButtonWithFrame:(CGRect)frame 323 | horizontalAlignment:(UIControlContentHorizontalAlignment)horizontalAlignment 324 | verticalAlignment:(UIControlContentVerticalAlignment)verticalAlignment 325 | contentEdgeInsets:(UIEdgeInsets)contentEdgeInsets 326 | normalImage:(UIImage *)normalImage 327 | highlightImage:(UIImage *)highlightImage 328 | disabledImage:(UIImage *)disabledImage 329 | target:(id)target 330 | action:(SEL)action; 331 | 332 | #pragma mark - 自定义:button 颜色 333 | /** 334 | UIButton:自定义 button backgroundColor 335 | 336 | @param backgroundColor backgroundColor 337 | */ 338 | - (void)ba_buttonSetBackgroundColor:(UIColor * __nullable)backgroundColor; 339 | 340 | /** 341 | UIButton:backgroundColor、normalStateColor、highlightedStateColor、disabledStateColor 342 | 343 | @param normalStateColor normalStateColor description 344 | @param highlightedStateColor highlightedStateColor description 345 | @param disabledStateColor disabledStateColor description 346 | */ 347 | - (void)ba_buttonBackgroundColorWithNormalStateColor:(UIColor *)normalStateColor 348 | highlightedStateColor:(UIColor *)highlightedStateColor 349 | disabledStateColor:(UIColor *)disabledStateColor; 350 | 351 | #pragma mark - 自定义 button backgroundImage 352 | /** 353 | UIButton:自定义 button backgroundImage、selectedBackgroundImage、highlightedBackgroundImage 354 | 355 | @param backgroundImage backgroundImage 356 | @param selectedBackgroundImage selectedBackgroundImage 357 | @param highlightedBackgroundImage highlightedBackgroundImage 358 | */ 359 | - (void)ba_buttonSetBackgroundImage:(UIImage * __nullable)backgroundImage 360 | selectedBackgroundImage:(UIImage * __nullable)selectedBackgroundImage 361 | highlightedBackgroundImage:(UIImage * __nullable)highlightedBackgroundImage; 362 | 363 | #pragma mark - 自定义 button image 364 | /** 365 | UIButton:自定义 button image、selectedImage、highlightedImage、disabledImage 366 | 367 | @param image image 368 | @param selectedImage selectedImage 369 | @param highlightedImage highlightedImage 370 | @param disabledImage disabledImage 371 | */ 372 | - (void)ba_buttonSetImage:(UIImage * __nullable)image 373 | selectedImage:(UIImage * __nullable)selectedImage 374 | highlightedImage:(UIImage * __nullable)highlightedImage 375 | disabledImage:(UIImage * __nullable)disabledImage; 376 | 377 | #pragma mark - 自定义 button title 378 | /** 379 | UIButton:自定义 button title、selectedTitle、highlightedTitle 380 | 381 | @param title title 382 | @param selectedTitle selectedTitle 383 | @param highlightedTitle highlightedTitle 384 | */ 385 | - (void)ba_buttonSetTitle:(NSString * __nullable)title 386 | selectedTitle:(NSString * __nullable)selectedTitle 387 | highlightedTitle:(NSString * __nullable)highlightedTitle; 388 | 389 | /** 390 | UIButton:自定义 button titleColor、selectedTitleColor、highlightedTitleColor、disabledTitleColor 391 | 392 | @param titleColor titleColor 393 | @param selectedTitleColor selectedTitleColor 394 | @param highlightedTitleColor highlightedTitleColor 395 | @param disabledTitleColor disabledTitleColor 396 | */ 397 | - (void)ba_buttonSetTitleColor:(UIColor * __nullable)titleColor 398 | selectedTitleColor:(UIColor * __nullable)selectedTitleColor 399 | highlightedTitleColor:(UIColor * __nullable)highlightedTitleColor 400 | disabledTitleColor:(UIColor * __nullable)disabledTitleColor; 401 | 402 | /** 403 | UIButton:自定义 button 字体、大小 404 | 405 | @param fontName fontName 406 | @param size size 407 | */ 408 | - (void)ba_buttonSetTitleFontName:(NSString *)fontName 409 | size:(CGFloat)size; 410 | 411 | #pragma mark - 点击事件 412 | /** 413 | UIButton:自定义 button 点击事件,默认:UIControlEventTouchUpInside 414 | 415 | @param target target 416 | @param tag tag 417 | @param action action 418 | */ 419 | - (void)ba_buttonAddTarget:(nullable id)target 420 | tag:(NSInteger)tag 421 | action:(SEL)action; 422 | 423 | #pragma mark - 布局样式 和 间距 424 | /** 425 | UIButton:快速设置 button 的布局样式 和 间距, 426 | 注意:如果后期动态改变文字或者图片后,需要在赋值之后重新调用此方法: 427 | 428 | @param type button 的布局样式 429 | @param padding 文字与图片之间的间距 430 | */ 431 | - (void)ba_button_setButtonLayoutType:(BAKit_ButtonLayoutType)type 432 | padding:(CGFloat)padding; 433 | 434 | #pragma mark - 快速切圆角 435 | /** 436 | UIButton:快速切圆角,注意:文字、字体大小、图片等设置一定要在设置 ba_button_setButtonLayoutType 之前设置,要不然计算会以默认字体大小计算,导致位置偏移,如果是 xib,需要要有固定 宽高,要不然 iOS 10 设置无效 437 | 438 | @param type 圆角样式 439 | @param viewCornerRadius 圆角角度 440 | */ 441 | - (void)ba_button_setViewRectCornerType:(BAKit_ViewRectCornerType)type 442 | viewCornerRadius:(CGFloat)viewCornerRadius; 443 | 444 | /** 445 | UIButton:快速切圆角,带边框、边框颜色,如果是 xib,需要要有固定 宽高,要不然 iOS 10 设置无效 446 | 447 | @param type 圆角样式 448 | @param viewCornerRadius 圆角角度 449 | @param borderWidth 边线宽度 450 | @param borderColor 边线颜色 451 | */ 452 | - (void)ba_button_setViewRectCornerType:(BAKit_ViewRectCornerType)type 453 | viewCornerRadius:(CGFloat)viewCornerRadius 454 | borderWidth:(CGFloat)borderWidth 455 | borderColor:(UIColor *)borderColor; 456 | 457 | #pragma mark - title 位置 458 | /** 459 | UIButton:title 位置 460 | 461 | @param horizontalAlignment horizontalAlignment description 462 | @param verticalAlignment verticalAlignment description 463 | @param contentEdgeInsets contentEdgeInsets description 464 | */ 465 | - (void)ba_buttonTitleLabelHorizontalAlignment:(UIControlContentHorizontalAlignment)horizontalAlignment 466 | verticalAlignment:(UIControlContentVerticalAlignment)verticalAlignment 467 | contentEdgeInsets:(UIEdgeInsets)contentEdgeInsets; 468 | 469 | #pragma mark - 给 View 添加点击音效 470 | /** 471 | UIButton:给 button 添加点击音效(一般用于 button 按钮的点击音效),注意,此方法不带播放结束回调,如果需要播放结束回调,请将 .m 文件中的 C 函数(soundCompleteCallBack)回调复制到播放按钮的.m 里,在里面做相关处理即可 472 | 473 | @param filename 音乐文件名称 474 | @param isNeedShock 是否播放音效并震动 475 | */ 476 | - (void)ba_buttonPlaySoundEffectWithFileName:(NSString *)filename 477 | isNeedShock:(BOOL)isNeedShock; 478 | 479 | @end 480 | 481 | @interface UIImage (BAButton) 482 | 483 | /** 484 | UIImage:创建一个 纯颜色 图片【全部铺满】 485 | 486 | @param color color 487 | @return 纯颜色 图片 488 | */ 489 | + (UIImage *)ba_image_Color:(UIColor *)color; 490 | 491 | /** 492 | UIImage:创建一个 纯颜色 图片【可以设置 size】 493 | 494 | @param color color 495 | @param size size 496 | @return 纯颜色 图片 497 | */ 498 | + (UIImage *)ba_image_Color:(UIColor *)color size:(CGSize)size; 499 | 500 | /** 501 | UIImage:根据宽比例去缩放图片 502 | 503 | @param width width description 504 | @return UIImage 505 | */ 506 | - (UIImage *)ba_imageScaleToWidth:(CGFloat)width; 507 | 508 | @end 509 | 510 | 511 | NS_ASSUME_NONNULL_END 512 | 513 | 514 | -------------------------------------------------------------------------------- /BAButton/Classes/BAButton/UIButton+BAState.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+BAState.h 3 | // BAButton 4 | // 5 | // Created by 任子丰 on 17/5/25. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UIButton (BAState) 14 | /** 15 | * 获取当前borderColor 16 | */ 17 | @property(nonatomic, readonly, strong) UIColor *ba_currentBorderColor; 18 | 19 | /** 20 | * 获取当前backgroundColor 21 | */ 22 | @property(nonatomic, readonly, strong) UIColor *ba_currentBackgroundColor; 23 | 24 | /** 25 | * 获取当前titleLabelFont 26 | */ 27 | @property(nonatomic, readonly, strong) UIFont *ba_currentTitleLabelFont; 28 | 29 | /** 30 | * 切换按钮状态时,执行动画的时间,默认0.25s(只有动画执行完毕后,才能会执行下一个点击事件) 31 | */ 32 | @property (nonatomic, assign) NSTimeInterval ba_animatedDuration; 33 | 34 | /** 35 | * 设置不同状态下的borderColor(支持动画效果) 36 | */ 37 | - (void)ba_buttonSetborderColor:(UIColor *)borderColor forState:(UIControlState)state animated:(BOOL)animated; 38 | 39 | /** 40 | * 设置不同状态下的backgroundColor(支持动画效果) 41 | */ 42 | - (void)ba_buttonSetBackgroundColor:(UIColor *)backgroundColor forState:(UIControlState)state animated:(BOOL)animated; 43 | 44 | /** 45 | * 设置不同状态下的titleLabelFont 46 | */ 47 | - (void)ba_buttonSetTitleLabelFont:(UIFont *)titleLabelFont forState:(UIControlState)state; 48 | 49 | /** 50 | * 获取某个状态的borderColor 51 | */ 52 | - (UIColor *)ba_buttonBorderColorForState:(UIControlState)state; 53 | 54 | /** 55 | * 获取某个状态的backgroundColor 56 | */ 57 | - (UIColor *)ba_buttonBackgroundColorForState:(UIControlState)state; 58 | 59 | /** 60 | * 获取某个状态的titleLabelFont 61 | */ 62 | - (UIFont *)ba_buttonTitleLabelFontForState:(UIControlState)state; 63 | 64 | /** 65 | BAButton:创建圆角半径阴影,带半径、阴影颜色 66 | 67 | @param cornerRadius 半径 68 | @param shadowColor 阴影颜色 69 | @param offset 偏移量 70 | @param opacity 透明度 71 | @param shadowRadius 模糊程度 72 | @param state 状态 73 | */ 74 | - (void)ba_buttonSetRoundShadowWithCornerRadius:(CGFloat)cornerRadius 75 | shadowColor:(UIColor *)shadowColor 76 | offset:(CGSize)offset 77 | opacity:(CGFloat)opacity 78 | shadowRadius:(CGFloat)shadowRadius 79 | forState:(UIControlState)state; 80 | 81 | #pragma mark - 使用key-value方式设置 82 | 83 | /** 84 | * key:@(UIControlState枚举) 85 | * 注:此方式无动画 86 | */ 87 | - (void)ba_buttonConfigBorderColors:(NSDictionary *)borderColors; 88 | 89 | /** 90 | * key:@(UIControlState枚举) 91 | * 注:此方式无动画 92 | */ 93 | - (void)ba_buttonConfigBackgroundColors:(NSDictionary *)backgroundColors; 94 | 95 | /** 96 | * key:@(UIControlState枚举) 97 | */ 98 | - (void)ba_buttonConfigTitleLabelFont:(NSDictionary *)titleLabelFonts; 99 | 100 | @end 101 | 102 | NS_ASSUME_NONNULL_END 103 | -------------------------------------------------------------------------------- /BAButton/Classes/BAButton/UIButton+BAState.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+BAState.m 3 | // BAButton 4 | // 5 | // Created by 任子丰 on 17/5/25. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #define BABackgroundColorKEY(state) [NSString stringWithFormat:@"backgroundColor%zd",state] 10 | #define BABorderColorKEY(state) [NSString stringWithFormat:@"borderColor%zd",state] 11 | 12 | #import "UIButton+BAState.h" 13 | #import "BAKit_ConfigurationDefine.h" 14 | #import 15 | 16 | // Model 17 | @interface BAPropertyModel : NSObject 18 | 19 | @property (nonatomic, assign) UIControlState state; 20 | @property (nonatomic, copy) NSString *keyPath; 21 | @property (nonatomic, weak) id value; 22 | 23 | + (instancetype)propertyModelWithValue:(nullable id)value keyPath:(NSString *)keyPath state:(UIControlState)state; 24 | 25 | @end 26 | 27 | @implementation BAPropertyModel 28 | 29 | + (instancetype)propertyModelWithValue:(id)value keyPath:(NSString *)keyPath state:(UIControlState)state { 30 | BAPropertyModel *model = [BAPropertyModel new]; 31 | model.value = value; 32 | model.keyPath = keyPath; 33 | model.state = state; 34 | return model; 35 | } 36 | 37 | @end 38 | 39 | @interface UIView (BAButton) 40 | 41 | /** 42 | UIView:创建圆角半径阴影,带半径、阴影颜色 43 | 44 | @param cornerRadius 半径 45 | @param shadowColor 阴影颜色 46 | @param offset 偏移量 47 | @param opacity 透明度 48 | @param shadowRadius 模糊程度 49 | */ 50 | - (void)ba_viewSetRoundShadowWithCornerRadius:(CGFloat)cornerRadius 51 | shadowColor:(UIColor *)shadowColor 52 | offset:(CGSize)offset 53 | opacity:(CGFloat)opacity 54 | shadowRadius:(CGFloat)shadowRadius; 55 | 56 | @end 57 | 58 | @implementation UIView (BAButton) 59 | 60 | /** 61 | UIView:创建圆角半径阴影,带半径、阴影颜色 62 | 63 | @param cornerRadius 半径 64 | @param shadowColor 阴影颜色 65 | @param offset 偏移量 66 | @param opacity 透明度 67 | @param shadowRadius 模糊程度 68 | */ 69 | - (void)ba_viewSetRoundShadowWithCornerRadius:(CGFloat)cornerRadius 70 | shadowColor:(UIColor *)shadowColor 71 | offset:(CGSize)offset 72 | opacity:(CGFloat)opacity 73 | shadowRadius:(CGFloat)shadowRadius { 74 | if (!shadowColor) { 75 | shadowColor = [UIColor blackColor]; 76 | } 77 | // 设置阴影的颜色 78 | self.layer.shadowColor = shadowColor.CGColor; 79 | // 设置阴影的透明度 80 | self.layer.shadowOpacity = opacity; 81 | // 设置阴影的偏移量 82 | self.layer.shadowOffset = offset; 83 | // 设置阴影的模糊程度 84 | self.layer.shadowRadius = shadowRadius; 85 | // 设置是否栅格化 86 | self.layer.shouldRasterize = YES; 87 | // 设置圆角半径 88 | self.layer.cornerRadius = cornerRadius; 89 | // 设置阴影的路径 90 | // self.layer.shadowPath = [[UIBezierPath bezierPathWithRoundedRect:[self bounds] 91 | // cornerRadius:cornerRadius] CGPath]; 92 | // 设置边界是否遮盖 93 | self.layer.masksToBounds = NO; 94 | } 95 | 96 | @end 97 | 98 | @interface UIButton () 99 | 100 | @property (nonatomic, strong) NSMutableDictionary *animates; 101 | @property (nonatomic, strong) NSMutableDictionary *borderColors; 102 | @property (nonatomic, strong) NSMutableDictionary *backgroundColors; 103 | @property (nonatomic, strong) NSMutableDictionary *titleLabelFonts; 104 | @property (nonatomic, strong) NSMutableArray *subViewPropertyArr; 105 | @property (nonatomic, assign) NSInteger subViewTag; 106 | 107 | @end 108 | 109 | @implementation UIButton (BAState) 110 | 111 | #pragma mark - lefe cycle 112 | 113 | + (void)load { 114 | BAKit_Objc_exchangeMethodAToB(@selector(setHighlighted:), 115 | @selector(ba_setHighlighted:)); 116 | BAKit_Objc_exchangeMethodAToB(@selector(setEnabled:), 117 | @selector(ba_setEnabled:)); 118 | BAKit_Objc_exchangeMethodAToB(@selector(setSelected:), 119 | @selector(ba_setSelected:)); 120 | } 121 | 122 | #pragma mark - public method 123 | 124 | - (UIColor *)ba_currentBorderColor { 125 | UIColor *color = [self ba_buttonBorderColorForState:self.state]; 126 | if (!color) { 127 | color = [UIColor colorWithCGColor:self.layer.borderColor]; 128 | } 129 | return color; 130 | } 131 | 132 | - (UIColor *)ba_currentBackgroundColor { 133 | UIColor *color = [self ba_buttonBackgroundColorForState:self.state]; 134 | if (!color) { 135 | color = self.backgroundColor; 136 | } 137 | return color; 138 | } 139 | 140 | - (UIFont *)ba_currentTitleLabelFont { 141 | UIFont *font = [self ba_buttonTitleLabelFontForState:(self.state-1)]; 142 | if (!font) { 143 | font = self.titleLabel.font; 144 | } 145 | return font; 146 | } 147 | 148 | - (void)ba_buttonSetBackgroundColor:(UIColor *)backgroundColor forState:(UIControlState)state animated:(BOOL)animated { 149 | if (backgroundColor) { 150 | [self.backgroundColors setObject:backgroundColor forKey:@(state)]; 151 | [self.animates setObject:@(animated) forKey:BABackgroundColorKEY(state)]; 152 | } 153 | if(self.state == state) { 154 | self.backgroundColor = backgroundColor; 155 | } 156 | } 157 | 158 | - (void)ba_buttonSetborderColor:(UIColor *)borderColor forState:(UIControlState)state animated:(BOOL)animated { 159 | if (borderColor) { 160 | [self.borderColors setObject:borderColor forKey:@(state)]; 161 | [self.animates setObject:@(animated) forKey:BABorderColorKEY(state)]; 162 | } 163 | if(self.state == state) { 164 | self.layer.borderColor = borderColor.CGColor; 165 | } 166 | } 167 | 168 | - (void)ba_buttonSetTitleLabelFont:(UIFont *)titleLabelFont forState:(UIControlState)state { 169 | if (titleLabelFont) { 170 | [self.titleLabelFonts setObject:titleLabelFont forKey:@(state)]; 171 | } 172 | if(self.state == state) { 173 | self.titleLabel.font = titleLabelFont; 174 | } 175 | } 176 | 177 | - (UIColor *)ba_buttonBorderColorForState:(UIControlState)state { 178 | return [self.borderColors objectForKey:@(state)]; 179 | } 180 | 181 | - (UIColor *)ba_buttonBackgroundColorForState:(UIControlState)state { 182 | return [self.backgroundColors objectForKey:@(state)]; 183 | } 184 | 185 | - (UIFont *)ba_buttonTitleLabelFontForState:(UIControlState)state { 186 | return [self.titleLabelFonts objectForKey:@(state)]; 187 | } 188 | 189 | - (void)ba_buttonConfigBorderColors:(NSDictionary *)borderColors { 190 | self.borderColors = [borderColors mutableCopy]; 191 | [borderColors enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull key, UIColor * _Nonnull obj, BOOL * _Nonnull stop) { 192 | [self.animates setObject:@(NO) forKey:BABorderColorKEY(key.integerValue)]; 193 | }]; 194 | [self updateButton]; 195 | } 196 | 197 | - (void)ba_buttonConfigBackgroundColors:(NSDictionary *)backgroundColors { 198 | self.backgroundColors = [backgroundColors mutableCopy]; 199 | [backgroundColors enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull key, UIColor * _Nonnull obj, BOOL * _Nonnull stop) { 200 | [self.animates setObject:@(NO) forKey:BABackgroundColorKEY(key.integerValue)]; 201 | }]; 202 | [self updateButton]; 203 | } 204 | 205 | - (void)ba_buttonConfigTitleLabelFont:(NSDictionary *)titleLabelFonts { 206 | self.titleLabelFonts = [titleLabelFonts mutableCopy]; 207 | [self updateButton]; 208 | } 209 | 210 | #pragma mark - override 211 | 212 | - (void)ba_setSelected:(BOOL)selected { 213 | [self ba_setSelected:selected]; 214 | [self updateButton]; 215 | } 216 | 217 | - (void)ba_setEnabled:(BOOL)enabled { 218 | [self ba_setEnabled:enabled]; 219 | [self updateButton]; 220 | } 221 | 222 | - (void)ba_setHighlighted:(BOOL)highlighted { 223 | [self ba_setHighlighted:highlighted]; 224 | [self updateButton]; 225 | } 226 | 227 | #pragma mark - private method 228 | 229 | - (void)updateButton { 230 | // updateBackgroundColor 231 | UIColor *backgroundColor = [self ba_buttonBackgroundColorForState:self.state]; 232 | if (backgroundColor) { 233 | [self updateBackgroundColor:backgroundColor]; 234 | } else { 235 | UIColor *normalColor = [self ba_buttonBackgroundColorForState:UIControlStateNormal]; 236 | if (normalColor) { 237 | [self updateBackgroundColor:normalColor]; 238 | } 239 | } 240 | 241 | // updateBorderColor 242 | UIColor *borderColor = [self ba_buttonBorderColorForState:self.state]; 243 | if (borderColor) { 244 | [self updateBorderColor:borderColor]; 245 | } else { 246 | UIColor *normalColor = [self ba_buttonBorderColorForState:UIControlStateNormal]; 247 | if (normalColor) { 248 | [self updateBorderColor:normalColor]; 249 | } 250 | } 251 | 252 | // updateTitleLabelFont 253 | UIFont *titleLabelFont = [self ba_buttonTitleLabelFontForState:self.state]; 254 | if (titleLabelFont) { 255 | self.titleLabel.font = titleLabelFont; 256 | } else { 257 | UIFont *normalFont = [self ba_buttonTitleLabelFontForState:UIControlStateNormal]; 258 | if (normalFont) { 259 | self.titleLabel.font = normalFont; 260 | } 261 | } 262 | 263 | // updateSubViewProperty 264 | UIView *subView = [self viewWithTag:self.subViewTag]; 265 | if (subView && self.subViewPropertyArr.count>0) { 266 | [self.subViewPropertyArr enumerateObjectsUsingBlock:^(BAPropertyModel * _Nonnull model, NSUInteger idx, BOOL * _Nonnull stop) { 267 | //点击一次,方法多次调用,model.value可能为nil,此时不应进入赋值,否则覆盖掉之前的值 268 | if (self.state == model.state && model.value) { 269 | //转换成nil 270 | id nullableValue = (model.value == [NSNull null]) ? nil : model.value; 271 | [subView setValue:nullableValue forKeyPath:model.keyPath]; 272 | } 273 | }]; 274 | } 275 | } 276 | 277 | - (void)updateBackgroundColor:(UIColor *)backgroundColor { 278 | NSNumber *animateValue = [self.animates objectForKey:BABackgroundColorKEY(self.state)]; 279 | if (!animateValue) return;//不存在 280 | 281 | if (animateValue.integerValue == self.subViewTag) { 282 | self.backgroundColor = backgroundColor; 283 | } else { //等于1 284 | [UIView animateWithDuration:self.ba_animatedDuration animations:^{ 285 | self.backgroundColor = backgroundColor; 286 | }]; 287 | } 288 | } 289 | 290 | - (void)updateBorderColor:(UIColor *)borderColor { 291 | NSNumber *animateValue = [self.animates objectForKey:BABorderColorKEY(self.state)]; 292 | 293 | if (!animateValue) return;//不存在 294 | 295 | if (animateValue.integerValue == 0) { 296 | self.layer.borderColor = borderColor.CGColor; 297 | [self.layer removeAnimationForKey:@"KEYAnimation"]; 298 | } else {//等于1 299 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"borderColor"]; 300 | animation.fromValue = (__bridge id _Nullable)(self.layer.borderColor); 301 | animation.toValue = (__bridge id _Nullable)(borderColor.CGColor); 302 | animation.duration = self.ba_animatedDuration; 303 | animation.removedOnCompletion = NO; 304 | animation.fillMode = kCAFillModeForwards; 305 | [self.layer addAnimation:animation forKey:@"KEYAnimation"]; 306 | self.layer.borderColor = borderColor.CGColor; 307 | } 308 | } 309 | 310 | /** 311 | BAButton:创建圆角半径阴影,带半径、阴影颜色 312 | 313 | @param cornerRadius 半径 314 | @param shadowColor 阴影颜色 315 | @param offset 偏移量 316 | @param opacity 透明度 317 | @param shadowRadius 模糊程度 318 | @param state 状态 319 | */ 320 | - (void)ba_buttonSetRoundShadowWithCornerRadius:(CGFloat)cornerRadius 321 | shadowColor:(UIColor *)shadowColor 322 | offset:(CGSize)offset 323 | opacity:(CGFloat)opacity 324 | shadowRadius:(CGFloat)shadowRadius 325 | forState:(UIControlState)state { 326 | [self ba_viewSetRoundShadowWithCornerRadius:0 shadowColor:nil offset:CGSizeZero opacity:0 shadowRadius:0]; 327 | 328 | [self ba_viewSetRoundShadowWithCornerRadius:cornerRadius shadowColor:shadowColor offset:offset opacity:opacity shadowRadius:shadowRadius]; 329 | } 330 | 331 | #pragma mark - getters and setters 332 | 333 | - (void)setAnimates:(NSMutableDictionary *)animates { 334 | BAKit_Objc_setObj(@selector(animates),animates); 335 | } 336 | 337 | - (NSMutableDictionary *)animates { 338 | NSMutableDictionary *animates = BAKit_Objc_getObj; 339 | if (!animates) { 340 | animates = [NSMutableDictionary new]; 341 | self.animates = animates; 342 | } 343 | return animates; 344 | } 345 | 346 | - (void)setBorderColors:(NSMutableDictionary *)borderColors { 347 | BAKit_Objc_setObj(@selector(borderColors),borderColors); 348 | } 349 | 350 | - (NSMutableDictionary *)borderColors { 351 | NSMutableDictionary *borderColors = BAKit_Objc_getObj; 352 | if (!borderColors) { 353 | borderColors = [NSMutableDictionary new]; 354 | self.borderColors = borderColors; 355 | } 356 | return borderColors; 357 | } 358 | 359 | - (void)setBackgroundColors:(NSMutableDictionary *)backgroundColors { 360 | BAKit_Objc_setObj(@selector(backgroundColors),backgroundColors); 361 | } 362 | 363 | - (NSMutableDictionary *)backgroundColors { 364 | NSMutableDictionary *backgroundColors = BAKit_Objc_getObj; 365 | if(!backgroundColors) { 366 | backgroundColors = [[NSMutableDictionary alloc] init]; 367 | self.backgroundColors = backgroundColors; 368 | } 369 | return backgroundColors; 370 | } 371 | 372 | - (void)setTitleLabelFonts:(NSMutableDictionary *)titleLabelFonts { 373 | BAKit_Objc_setObj(@selector(titleLabelFonts),titleLabelFonts); 374 | } 375 | 376 | - (NSMutableDictionary *)titleLabelFonts { 377 | NSMutableDictionary *titleLabelFonts = BAKit_Objc_getObj; 378 | if(!titleLabelFonts) { 379 | titleLabelFonts = [[NSMutableDictionary alloc] init]; 380 | self.titleLabelFonts = titleLabelFonts; 381 | } 382 | return titleLabelFonts; 383 | } 384 | 385 | - (void)setBa_animatedDuration:(NSTimeInterval)ba_animatedDuration { 386 | BAKit_Objc_setObj(@selector(ba_animatedDuration),@(ba_animatedDuration)); 387 | } 388 | 389 | - (NSTimeInterval)ba_animatedDuration { 390 | NSTimeInterval duartion = [BAKit_Objc_getObj doubleValue]; 391 | if (duartion == 0) { 392 | duartion = 0.25; 393 | } 394 | return duartion; 395 | } 396 | 397 | - (void)setSubViewPropertyArr:(NSMutableArray *)subViewPropertyArr { 398 | BAKit_Objc_setObj(@selector(subViewPropertyArr),subViewPropertyArr); 399 | } 400 | 401 | - (NSMutableArray *)subViewPropertyArr { 402 | NSMutableArray *subViewPropertyArr = BAKit_Objc_getObj; 403 | if(!subViewPropertyArr) { 404 | subViewPropertyArr = [[NSMutableArray alloc] init]; 405 | self.subViewPropertyArr = subViewPropertyArr; 406 | } 407 | return subViewPropertyArr; 408 | } 409 | 410 | - (void)setSubViewTag:(NSInteger)subViewTag { 411 | BAKit_Objc_setObj(@selector(subViewTag),@(subViewTag)); 412 | } 413 | 414 | - (NSInteger)subViewTag { 415 | return [BAKit_Objc_getObj integerValue]; 416 | } 417 | 418 | @end 419 | -------------------------------------------------------------------------------- /BAButton/Classes/BAButton/UIView+BARectCorner.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * BABaseProject 5 | * 6 | * @brief BAKit 7 | * 8 | * @author 博爱 9 | * @copyright Copyright © 2016年 博爱. All rights reserved. 10 | * @version V1.0 11 | */ 12 | 13 | // _ooOoo_ 14 | // o8888888o 15 | // 88" . "88 16 | // (| -_- |) 17 | // O\ = /O 18 | // ____/`---'\____ 19 | // . ' \\| |// `. 20 | // / \\||| : |||// \ 21 | // / _||||| -:- |||||- \ 22 | // | | \\\ - /// | | 23 | // | \_| ''\---/'' | | 24 | // \ .-\__ `-` ___/-. / 25 | // ___`. .' /--.--\ `. . __ 26 | // ."" '< `.___\_<|>_/___.' >'"". 27 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 28 | // \ \ `-. \_ __\ /__ _/ .-` / / 29 | // ======`-.____`-.___\_____/___.-`____.-'====== 30 | // `=---=' 31 | // 32 | // ............................................. 33 | // 佛祖镇楼 BUG辟易 34 | // 佛曰: 35 | // 写字楼里写字间,写字间里程序员; 36 | // 程序人员写程序,又拿程序换酒钱。 37 | // 酒醒只在网上坐,酒醉还来网下眠; 38 | // 酒醉酒醒日复日,网上网下年复年。 39 | // 但愿老死电脑间,不愿鞠躬老板前; 40 | // 奔驰宝马贵者趣,公交自行程序员。 41 | // 别人笑我忒疯癫,我笑自己命太贱; 42 | // 不见满街漂亮妹,哪个归得程序员? 43 | 44 | /* 45 | 46 | ********************************************************************************* 47 | * 48 | * 在使用BAKit的过程中如果出现bug请及时以以下任意一种方式联系我,我会及时修复bug 49 | * 50 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 51 | * 微博 : 博爱1616 52 | * Email : 137361770@qq.com 53 | * GitHub : https://github.com/boai 54 | * 博客 : http://boaihome.com 55 | 56 | ********************************************************************************* 57 | 58 | */ 59 | 60 | 61 | #import 62 | 63 | /*! 64 | * 设置 viewRectCornerType 样式, 65 | * 注意:BAKit_ViewRectCornerType 必须要先设置 viewCornerRadius,才能有效,否则设置无效, 66 | */ 67 | typedef NS_ENUM(NSInteger, BAKit_ViewRectCornerType) { 68 | 69 | /*! 70 | * 设置全部四个角 圆角半径 71 | */ 72 | BAKit_ViewRectCornerTypeAllCorners = 0, 73 | /*! 74 | * 设置下左角 圆角半径 75 | */ 76 | BAKit_ViewRectCornerTypeBottomLeft, 77 | /*! 78 | * 设置下右角 圆角半径 79 | */ 80 | BAKit_ViewRectCornerTypeBottomRight, 81 | /*! 82 | * 设置上左角 圆角半径 83 | */ 84 | BAKit_ViewRectCornerTypeTopLeft, 85 | /*! 86 | * 设置下右角 圆角半径 87 | */ 88 | BAKit_ViewRectCornerTypeTopRight, 89 | /*! 90 | * 设置下左、下右角 圆角半径 91 | */ 92 | BAKit_ViewRectCornerTypeBottomLeftAndBottomRight, 93 | /*! 94 | * 设置上左、上右角 圆角半径 95 | */ 96 | BAKit_ViewRectCornerTypeTopLeftAndTopRight, 97 | /*! 98 | * 设置上左、下右角 圆角半径 99 | */ 100 | BAKit_ViewRectCornerTypeTopLeftAndBottomRight, 101 | /*! 102 | * 设置下左、上左角 圆角半径 103 | */ 104 | BAKit_ViewRectCornerTypeBottomLeftAndTopLeft, 105 | /*! 106 | * 设置下右、上右角 圆角半径 107 | */ 108 | BAKit_ViewRectCornerTypeBottomRightAndTopRight, 109 | /*! 110 | * 设置上左、上右、下右角 圆角半径 111 | */ 112 | BAKit_ViewRectCornerTypeBottomRightAndTopRightAndTopLeft, 113 | /*! 114 | * 设置下右、上右、下左角 圆角半径 115 | */ 116 | BAKit_ViewRectCornerTypeBottomRightAndTopRightAndBottomLeft, 117 | }; 118 | 119 | @interface UIView (BARectCorner) 120 | 121 | /** 122 | 设置 viewRectCornerType 样式,注意:BAKit_ViewRectCornerType 必须要先设置 viewCornerRadius,才能有效,否则设置无效,如果是 xib,需要要有固定 宽高,要不然 iOS 10 设置无效 123 | */ 124 | @property (nonatomic, assign) BAKit_ViewRectCornerType ba_viewRectCornerType; 125 | 126 | /** 127 | 设置 view :圆角,如果要全部设置四个角的圆角,可以直接用这个方法,必须要在设置 frame 之后,注意:如果是 xib,需要要有固定 宽高,要不然 iOS 10 设置无效 128 | */ 129 | @property (nonatomic, assign) CGFloat ba_viewCornerRadius; 130 | 131 | /** 132 | 设置 view :边框边线宽度 133 | */ 134 | @property(nonatomic, assign) CGFloat ba_viewBorderWidth; 135 | 136 | /** 137 | 设置 view :边框边线颜色 138 | */ 139 | @property(nonatomic, strong) UIColor *ba_viewBorderColor; 140 | 141 | 142 | /** 143 | 快速切圆角 144 | 145 | @param type 圆角样式 146 | @param viewCornerRadius 圆角角度 147 | */ 148 | - (void)ba_view_setViewRectCornerType:(BAKit_ViewRectCornerType)type 149 | viewCornerRadius:(CGFloat)viewCornerRadius; 150 | 151 | /** 152 | 快速切圆角,带边框、边框颜色 153 | 154 | @param type 圆角样式 155 | @param viewCornerRadius 圆角角度 156 | @param borderWidth 边线宽度 157 | @param borderColor 边线颜色 158 | */ 159 | - (void)ba_view_setViewRectCornerType:(BAKit_ViewRectCornerType)type 160 | viewCornerRadius:(CGFloat)viewCornerRadius 161 | borderWidth:(CGFloat)borderWidth 162 | borderColor:(UIColor *)borderColor; 163 | 164 | 165 | @end 166 | -------------------------------------------------------------------------------- /BAButton/Classes/BAButton/UIView+BARectCorner.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+BARectCorner.m 3 | // BAButton 4 | // 5 | // Created by boai on 2017/5/19. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #import "UIView+BARectCorner.h" 10 | #import "BAKit_ConfigurationDefine.h" 11 | 12 | @implementation UIView (BARectCorner) 13 | 14 | - (void)ba_view_setViewRectCornerType:(BAKit_ViewRectCornerType)type viewCornerRadius:(CGFloat)viewCornerRadius { 15 | self.ba_viewCornerRadius = viewCornerRadius; 16 | self.ba_viewRectCornerType = type; 17 | } 18 | 19 | /** 20 | 快速切圆角,带边框、边框颜色 21 | 22 | @param type 圆角样式 23 | @param viewCornerRadius 圆角角度 24 | @param borderWidth 边线宽度 25 | @param borderColor 边线颜色 26 | */ 27 | - (void)ba_view_setViewRectCornerType:(BAKit_ViewRectCornerType)type viewCornerRadius:(CGFloat)viewCornerRadius borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor { 28 | self.ba_viewCornerRadius = viewCornerRadius; 29 | self.ba_viewRectCornerType = type; 30 | self.ba_viewBorderWidth = borderWidth; 31 | self.ba_viewBorderColor = borderColor; 32 | } 33 | 34 | #pragma mark - view 的 角半径,默认 CGSizeMake(0, 0) 35 | - (void)setupViewCornerType { 36 | 37 | if (CGRectEqualToRect(self.bounds, CGRectZero)) { 38 | NSLog(@"******** %s view frame 错误!", __func__); 39 | } 40 | UIRectCorner corners; 41 | CGSize cornerRadii; 42 | 43 | cornerRadii = CGSizeMake(self.ba_viewCornerRadius, self.ba_viewCornerRadius); 44 | 45 | switch (self.ba_viewRectCornerType) { 46 | case BAKit_ViewRectCornerTypeBottomLeft: { 47 | corners = UIRectCornerBottomLeft; 48 | } break; 49 | case BAKit_ViewRectCornerTypeBottomRight: { 50 | corners = UIRectCornerBottomRight; 51 | } break; 52 | case BAKit_ViewRectCornerTypeTopLeft: { 53 | corners = UIRectCornerTopLeft; 54 | } break; 55 | case BAKit_ViewRectCornerTypeTopRight: { 56 | corners = UIRectCornerTopRight; 57 | } break; 58 | case BAKit_ViewRectCornerTypeBottomLeftAndBottomRight: { 59 | corners = UIRectCornerBottomLeft | UIRectCornerBottomRight; 60 | } break; 61 | case BAKit_ViewRectCornerTypeTopLeftAndTopRight: { 62 | corners = UIRectCornerTopLeft | UIRectCornerTopRight; 63 | } break; 64 | case BAKit_ViewRectCornerTypeTopLeftAndBottomRight: { 65 | corners = UIRectCornerTopLeft | UIRectCornerBottomRight; 66 | } break; 67 | case BAKit_ViewRectCornerTypeBottomLeftAndTopLeft: { 68 | corners = UIRectCornerBottomLeft | UIRectCornerTopLeft; 69 | } break; 70 | case BAKit_ViewRectCornerTypeBottomRightAndTopRight: { 71 | corners = UIRectCornerBottomRight | UIRectCornerTopRight; 72 | } break; 73 | case BAKit_ViewRectCornerTypeBottomRightAndTopRightAndTopLeft: { 74 | corners = UIRectCornerBottomRight | UIRectCornerTopRight | UIRectCornerTopLeft; 75 | } break; 76 | case BAKit_ViewRectCornerTypeBottomRightAndTopRightAndBottomLeft: { 77 | corners = UIRectCornerBottomRight | UIRectCornerTopRight | UIRectCornerBottomLeft; 78 | } break; 79 | case BAKit_ViewRectCornerTypeAllCorners: { 80 | corners = UIRectCornerAllCorners; 81 | } break; 82 | default: 83 | break; 84 | } 85 | 86 | UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds 87 | byRoundingCorners:corners 88 | cornerRadii:cornerRadii]; 89 | CAShapeLayer *shapeLayer = [CAShapeLayer layer]; 90 | shapeLayer.path = bezierPath.CGPath; 91 | shapeLayer.frame = self.bounds; 92 | 93 | self.layer.mask = shapeLayer; 94 | 95 | if (self.ba_viewBorderWidth > 0) { 96 | CAShapeLayer *borderLayer = [CAShapeLayer layer]; 97 | borderLayer.path = bezierPath.CGPath; 98 | borderLayer.fillColor = [UIColor clearColor].CGColor; 99 | borderLayer.strokeColor = self.ba_viewBorderColor.CGColor; 100 | borderLayer.lineWidth = self.ba_viewBorderWidth; 101 | borderLayer.frame = self.bounds; 102 | [self.layer addSublayer:borderLayer]; 103 | } 104 | 105 | // self.clipsToBounds = YES; 106 | } 107 | 108 | #pragma mark - setter / getter 109 | - (void)setBa_viewRectCornerType:(BAKit_ViewRectCornerType)ba_viewRectCornerType { 110 | BAKit_Objc_setObj(@selector(ba_viewRectCornerType), @(ba_viewRectCornerType)); 111 | [self setupViewCornerType]; 112 | } 113 | 114 | - (BAKit_ViewRectCornerType)ba_viewRectCornerType { 115 | return [BAKit_Objc_getObj integerValue]; 116 | } 117 | 118 | - (void)setBa_viewCornerRadius:(CGFloat)ba_viewCornerRadius { 119 | BAKit_Objc_setObj(@selector(ba_viewCornerRadius), @(ba_viewCornerRadius)); 120 | } 121 | 122 | - (CGFloat)ba_viewCornerRadius { 123 | return [BAKit_Objc_getObj integerValue]; 124 | } 125 | 126 | - (void)setBa_viewBorderWidth:(CGFloat)ba_viewBorderWidth { 127 | BAKit_Objc_setObj(@selector(ba_viewBorderWidth), @(ba_viewBorderWidth)); 128 | [self setupViewCornerType]; 129 | } 130 | 131 | - (CGFloat)ba_viewBorderWidth { 132 | return [BAKit_Objc_getObj floatValue]; 133 | } 134 | 135 | - (void)setBa_viewBorderColor:(UIColor *)ba_viewBorderColor { 136 | BAKit_Objc_setObj(@selector(ba_viewBorderColor), ba_viewBorderColor); 137 | [self setupViewCornerType]; 138 | } 139 | 140 | - (UIColor *)ba_viewBorderColor { 141 | return BAKit_Objc_getObj; 142 | } 143 | 144 | @end 145 | -------------------------------------------------------------------------------- /Example/BAButton.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/BAButton.xcodeproj/xcshareddata/xcschemes/BAButton-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 42 | 48 | 49 | 50 | 51 | 52 | 62 | 64 | 70 | 71 | 72 | 73 | 79 | 81 | 87 | 88 | 89 | 90 | 92 | 93 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /Example/BAButton.xcodeproj/xcuserdata/Alria.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BAButton-Example.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Example/BAButton.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/BAButton.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/BAButton.xcworkspace/xcuserdata/Alria.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton.xcworkspace/xcuserdata/Alria.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Example/BAButton.xcworkspace/xcuserdata/Alria.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/BAButton.xcworkspace/xcuserdata/sunboyan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton.xcworkspace/xcuserdata/sunboyan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Example/BAButton.xcworkspace/xcuserdata/sunboyan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "29x29", 26 | "scale" : "3x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "40x40", 36 | "scale" : "3x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "57x57", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "iphone", 45 | "size" : "57x57", 46 | "scale" : "2x" 47 | }, 48 | { 49 | "idiom" : "iphone", 50 | "size" : "60x60", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "iphone", 55 | "size" : "60x60", 56 | "scale" : "3x" 57 | }, 58 | { 59 | "idiom" : "ios-marketing", 60 | "size" : "1024x1024", 61 | "scale" : "1x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/tabbar_mainframeHL.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "tabbar_mainframeHL@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "tabbar_mainframeHL@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/tabbar_mainframeHL.imageset/tabbar_mainframeHL@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Assets.xcassets/tabbar_mainframeHL.imageset/tabbar_mainframeHL@2x.png -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/tabbar_mainframeHL.imageset/tabbar_mainframeHL@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Assets.xcassets/tabbar_mainframeHL.imageset/tabbar_mainframeHL@3x.png -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_01.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "oneT@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "oneT@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_01.imageset/oneT@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Assets.xcassets/倒计时/Countdown_01.imageset/oneT@2x.png -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_01.imageset/oneT@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Assets.xcassets/倒计时/Countdown_01.imageset/oneT@3x.png -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_02.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "twoT@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "twoT@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_02.imageset/twoT@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Assets.xcassets/倒计时/Countdown_02.imageset/twoT@2x.png -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_02.imageset/twoT@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Assets.xcassets/倒计时/Countdown_02.imageset/twoT@3x.png -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_03.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "threeT@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "threeT@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_03.imageset/threeT@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Assets.xcassets/倒计时/Countdown_03.imageset/threeT@2x.png -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_03.imageset/threeT@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Assets.xcassets/倒计时/Countdown_03.imageset/threeT@3x.png -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_04.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "fourT@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "fourT@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_04.imageset/fourT@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Assets.xcassets/倒计时/Countdown_04.imageset/fourT@2x.png -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_04.imageset/fourT@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Assets.xcassets/倒计时/Countdown_04.imageset/fourT@3x.png -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_05.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "fiveT@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "fiveT@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_05.imageset/fiveT@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Assets.xcassets/倒计时/Countdown_05.imageset/fiveT@2x.png -------------------------------------------------------------------------------- /Example/BAButton/Assets.xcassets/倒计时/Countdown_05.imageset/fiveT@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Assets.xcassets/倒计时/Countdown_05.imageset/fiveT@3x.png -------------------------------------------------------------------------------- /Example/BAButton/BAAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // BAAppDelegate.h 3 | // BAButton 4 | // 5 | // Created by boai on 11/15/2018. 6 | // Copyright (c) 2018 boai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BAAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/BAButton/BAAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // BAAppDelegate.m 3 | // BAButton 4 | // 5 | // Created by boai on 11/15/2018. 6 | // Copyright (c) 2018 boai. All rights reserved. 7 | // 8 | 9 | #import "BAAppDelegate.h" 10 | //#import "BAViewController.h" 11 | 12 | @implementation BAAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 15 | // Override point for customization after application launch. 16 | 17 | return YES; 18 | } 19 | 20 | - (void)applicationWillResignActive:(UIApplication *)application { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application { 26 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 27 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 28 | } 29 | 30 | - (void)applicationWillEnterForeground:(UIApplication *)application { 31 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 32 | } 33 | 34 | - (void)applicationDidBecomeActive:(UIApplication *)application { 35 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 36 | } 37 | 38 | - (void)applicationWillTerminate:(UIApplication *)application { 39 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Example/BAButton/BAButton-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(CURRENT_PROJECT_VERSION) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/BAButton/BAButton-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | @import UIKit; 15 | @import Foundation; 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/BAButton/BAViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BAViewController.h 3 | // BAButton 4 | // 5 | // Created by boai on 11/15/2018. 6 | // Copyright (c) 2018 boai. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface BAViewController : UIViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/BAButton/BAViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BAViewController.m 3 | // BAButton 4 | // 5 | // Created by boai on 11/15/2018. 6 | // Copyright (c) 2018 boai. All rights reserved. 7 | // 8 | 9 | #import "BAViewController.h" 10 | 11 | #import "ViewController2.h" 12 | #import "ViewController3.h" 13 | #import "BAButton.h" 14 | 15 | @interface BAViewController () 16 | 17 | //@property(nonatomic, strong) UIButton *button; 18 | 19 | @end 20 | 21 | @implementation BAViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | 26 | self.title = @"BAButton"; 27 | 28 | [self initUI]; 29 | [self initNavi]; 30 | } 31 | 32 | - (void)initNavi { 33 | CGRect frame = CGRectMake(0, 0, 80, 40); 34 | UIButton *navi_rightButton = [UIButton ba_creatButtonWithFrame:frame title:@"xib" selTitle:nil titleColor:BAKit_Color_Red_pod titleFont:nil image:[UIImage imageNamed:@"tabbar_mainframeHL"] selImage:nil padding:2 buttonPositionStyle:BAKit_ButtonLayoutTypeCenterImageRight viewRectCornerType:BAKit_ViewRectCornerTypeAllCorners viewCornerRadius:20 target:self selector:@selector(handleRightNaviButtonAction:)]; 35 | navi_rightButton.backgroundColor = BAKit_Color_RandomRGB_pod(); 36 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:navi_rightButton]; 37 | 38 | UIButton *navi_leftButton = [UIButton ba_creatButtonWithFrame:frame title:@"state" selTitle:nil titleColor:BAKit_Color_Red_pod titleFont:nil image:[UIImage imageNamed:@"tabbar_mainframeHL"] selImage:nil padding:2 buttonPositionStyle:BAKit_ButtonLayoutTypeCenterImageRight viewRectCornerType:BAKit_ViewRectCornerTypeAllCorners viewCornerRadius:20 target:self selector:@selector(handleLeftNaviButtonAction:)]; 39 | [navi_rightButton ba_view_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomLeftAndTopLeft viewCornerRadius:20 borderWidth:2.0f borderColor:BAKit_Color_RandomRGB_pod()]; 40 | navi_rightButton.backgroundColor = BAKit_Color_RandomRGBA_pod(); 41 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:navi_leftButton]; 42 | 43 | // 点击事件 Block 返回! 44 | BAKit_WeakSelf 45 | navi_leftButton.ba_buttonActionBlock = ^(UIButton * _Nonnull button) { 46 | BAKit_StrongSelf 47 | // 添加按钮点击音效和震动效果 48 | // [button ba_buttonPlaySoundEffectWithFileName:@"begin.mp3" isNeedShock:YES]; 49 | [self.navigationController pushViewController:[ViewController3 new] animated:YES]; 50 | }; 51 | 52 | navi_rightButton.ba_buttonActionBlock = ^(UIButton * _Nonnull button) { 53 | BAKit_StrongSelf 54 | // 添加按钮点击音效和震动效果 55 | // [button ba_buttonPlaySoundEffectWithFileName:@"failure.mp3" isNeedShock:YES]; 56 | [self.navigationController pushViewController:[ViewController2 new] animated:YES]; 57 | }; 58 | } 59 | 60 | - (void)handleLeftNaviButtonAction:(UIButton *)sender { 61 | // 添加按钮点击音效和震动效果 62 | // [sender ba_viewPlaySoundEffectWithFileName:@"begin.mp3" isNeedShock:YES]; 63 | // [self.navigationController pushViewController:[ViewController3 new] animated:YES]; 64 | } 65 | 66 | - (void)handleRightNaviButtonAction:(UIButton *)sender { 67 | // 添加按钮点击音效和震动效果 68 | // [sender ba_buttonPlaySoundEffectWithFileName:@"failure.mp3" isNeedShock:YES]; 69 | // [self.navigationController pushViewController:[ViewController2 new] animated:YES]; 70 | } 71 | 72 | - (void)initUI { 73 | 74 | CGRect textFieldFrame = CGRectMake(50, kStatusBarAndNavigationBarHeight + 10, BAKit_SCREEN_WIDTH - 50 * 2, 50); 75 | 76 | if (kStatusBarHeight > 20) { 77 | UITextField *textField = UITextField.new; 78 | textField.backgroundColor = UIColor.greenColor; 79 | textField.placeholder = @"修复 iPhone X 等异形屏键盘异常"; 80 | textField.frame = textFieldFrame; 81 | [self.view addSubview:textField]; 82 | } 83 | 84 | CGFloat min_x = 40; 85 | CGFloat min_y = (kStatusBarHeight > 20) ? CGRectGetMaxY(textFieldFrame) + 10 : kStatusBarAndNavigationBarHeight + 10; 86 | CGFloat min_w = CGRectGetWidth(self.view.frame) - min_x * 2; 87 | // CGFloat min_w = 200; 88 | 89 | CGFloat min_h = 0; 90 | CGFloat min_space = 5; 91 | 92 | for (NSInteger i = 0; i < 8; i ++) { 93 | min_h = 30; 94 | if (i == 2 || i == 3) { 95 | min_h = min_w * 0.5; 96 | } 97 | 98 | // 原生写法 99 | // UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 100 | // button.frame = CGRectMake(min_x, min_y, min_w, min_h); 101 | // button.backgroundColor = BAKit_Color_RandomRGBA_pod(); 102 | // button.titleLabel.font = [UIFont systemFontOfSize:13]; 103 | // [button setImage:[UIImage imageNamed:@"tabbar_mainframeHL"] forState:UIControlStateNormal]; 104 | 105 | // BAButton 简单写法 106 | UIButton *button = [UIButton ba_buttonWithFrame:CGRectMake(min_x, min_y, min_w, min_h) 107 | title:nil 108 | titleColor:nil 109 | titleFont:[UIFont systemFontOfSize:13] 110 | image:[UIImage imageNamed:@"tabbar_mainframeHL"] 111 | backgroundColor:BAKit_Color_RandomRGBA_pod()]; 112 | 113 | min_y = CGRectGetMaxY(button.frame) + min_space; 114 | 115 | CGFloat padding = 10; 116 | CGFloat viewCornerRadius = 15; 117 | BAKit_ButtonLayoutType type; 118 | 119 | switch (i) { 120 | case 0: { 121 | [button setTitle:@"默认样式:内容居中-图左文右" forState:UIControlStateNormal]; 122 | type = BAKit_ButtonLayoutTypeNormal; 123 | [button ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomRightAndTopRight viewCornerRadius:viewCornerRadius borderWidth:2.0f borderColor:BAKit_Color_RandomRGB_pod()]; 124 | } break; 125 | case 1: { 126 | [button setTitle:@"内容居中-图右文左" forState:UIControlStateNormal]; 127 | type = BAKit_ButtonLayoutTypeCenterImageRight; 128 | [button ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomRight viewCornerRadius:viewCornerRadius]; 129 | } break; 130 | case 2: { 131 | [button setTitle:@"内容居中-图上文下" forState:UIControlStateNormal]; 132 | // 测试大图片 button 的 layout 布局,如果你的图片宽高大于 自身的宽高,怎需要压缩后再配置布局 133 | // 根据宽比例去缩放图片,注意:如果button 的图片 太宽,需要调用此方法去等比压缩图片,压缩完的图片,记得要在frame 之后设置图片 134 | UIImage *stretchableButtonImage = [[UIImage imageNamed:@"条形码.jpg"] ba_imageScaleToWidth:button.frame.size.width]; 135 | [button setImage:stretchableButtonImage forState:UIControlStateNormal]; 136 | 137 | type = BAKit_ButtonLayoutTypeCenterImageTop; 138 | [button ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeTopLeftAndTopRight viewCornerRadius:viewCornerRadius * 2 borderWidth:2.0f borderColor:BAKit_Color_RandomRGB_pod()]; 139 | } break; 140 | case 3: { 141 | [button setTitle:@"内容居中-图下文上" forState:UIControlStateNormal]; 142 | type = BAKit_ButtonLayoutTypeCenterImageBottom; 143 | [button ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomRightAndTopRightAndTopLeft viewCornerRadius:viewCornerRadius * 2]; 144 | } break; 145 | case 4: { 146 | [button setTitle:@"内容居左-图左文右" forState:UIControlStateNormal]; 147 | type = BAKit_ButtonLayoutTypeLeftImageLeft; 148 | [button ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomRight viewCornerRadius:viewCornerRadius borderWidth:2.0f borderColor:BAKit_Color_RandomRGB_pod()]; 149 | button.ba_padding_inset = 20; 150 | } break; 151 | case 5: { 152 | [button setTitle:@"内容居左-图右文左" forState:UIControlStateNormal]; 153 | type = BAKit_ButtonLayoutTypeLeftImageRight; 154 | [button ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomLeftAndTopLeft viewCornerRadius:viewCornerRadius]; 155 | } break; 156 | case 6: { 157 | [button setTitle:@"内容居右-图左文右" forState:UIControlStateNormal]; 158 | type = BAKit_ButtonLayoutTypeRightImageLeft; 159 | [button ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomRightAndTopRightAndBottomLeft viewCornerRadius:viewCornerRadius]; 160 | } break; 161 | case 7: { 162 | button.ba_padding = 10; 163 | button.ba_padding_inset = 20; 164 | [button setTitle:@"内容居右-图右文左2" forState:UIControlStateNormal]; 165 | type = BAKit_ButtonLayoutTypeRightImageRight; 166 | [button ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeAllCorners viewCornerRadius:viewCornerRadius]; 167 | } break; 168 | 169 | default: { 170 | type = BAKit_ButtonLayoutTypeNormal; 171 | } break; 172 | } 173 | 174 | // 注意:文字、字体大小、图片等设置一定要在设置 ba_button_setBAButtonLayoutType 之前设置,要不然计算会以默认字体大小计算,导致位置偏移 175 | [button ba_button_setButtonLayoutType:type padding:padding]; 176 | 177 | [self.view addSubview:button]; 178 | } 179 | } 180 | 181 | //#pragma mark - 测试大图片 button 的 layout 布局,如果你的图片宽高大于 自身的宽高,怎需要压缩后再配置布局 182 | //- (UIButton *)button 183 | //{ 184 | // if (!_button) 185 | // { 186 | // // 测试大图片 button 的 layout 布局,如果你的图片宽高大于 自身的宽高,怎需要压缩后再配置布局 187 | // // 原生写法 188 | // // _button = [UIButton buttonWithType:UIButtonTypeCustom]; 189 | // // [_button setTitle:@"123456" forState:UIControlStateNormal]; 190 | // // [_button setTitleColor:BAKit_Color_Red_pod forState:UIControlStateNormal]; 191 | // // _button.backgroundColor = BAKit_Color_Gray_10_pod; 192 | // 193 | // // BAButton 简单写法 194 | // _button = [UIButton ba_buttonWithFrame:CGRectZero title:@"123456" titleColor:BAKit_Color_Red_pod titleFont:[UIFont systemFontOfSize:15] backgroundColor:BAKit_Color_Gray_10_pod]; 195 | // 196 | // [self.view addSubview:_button]; 197 | // } 198 | // return _button; 199 | //} 200 | 201 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 202 | [self.view endEditing:YES]; 203 | } 204 | 205 | @end 206 | 207 | -------------------------------------------------------------------------------- /Example/BAButton/Launch Screen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/BAButton/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Example/BAButton/Resources/begin.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Resources/begin.mp3 -------------------------------------------------------------------------------- /Example/BAButton/Resources/failure.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Resources/failure.mp3 -------------------------------------------------------------------------------- /Example/BAButton/Resources/条形码.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Example/BAButton/Resources/条形码.jpg -------------------------------------------------------------------------------- /Example/BAButton/ViewController2.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController2.h 3 | // BAButton 4 | // 5 | // Created by boai on 2017/5/20. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController2 : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/BAButton/ViewController2.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController2.m 3 | // BAButton 4 | // 5 | // Created by boai on 2017/5/20. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #import "ViewController2.h" 10 | #import "BAButton.h" 11 | 12 | @interface ViewController2 () 13 | 14 | @property (weak, nonatomic) IBOutlet UIButton *normalButton; 15 | @property (weak, nonatomic) IBOutlet UIButton *centerImageRightButton; 16 | @property (weak, nonatomic) IBOutlet UIButton *centerImageTopButton; 17 | @property (weak, nonatomic) IBOutlet UIButton *centerImageBottomButton; 18 | 19 | @property (weak, nonatomic) IBOutlet UIButton *leftImageLeftButton; 20 | @property (weak, nonatomic) IBOutlet UIButton *leftImageRightButton; 21 | @property (weak, nonatomic) IBOutlet UIButton *rightImageLeftButton; 22 | 23 | @property (weak, nonatomic) IBOutlet UIButton *rightImageRightButton; 24 | 25 | @end 26 | 27 | @implementation ViewController2 28 | 29 | - (void)viewDidLoad { 30 | [super viewDidLoad]; 31 | // Do any additional setup after loading the view. 32 | 33 | [self test]; 34 | } 35 | 36 | - (void)test { 37 | self.title = @"xib、storyboard"; 38 | CGFloat padding = 10; 39 | CGFloat viewCornerRadius = 15; 40 | 41 | [self.normalButton ba_button_setButtonLayoutType:BAKit_ButtonLayoutTypeNormal padding:padding]; 42 | 43 | [self.normalButton ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomRightAndTopRightAndBottomLeft viewCornerRadius:viewCornerRadius borderWidth:2.0f borderColor:BAKit_Color_RandomRGB_pod()]; 44 | 45 | [self.centerImageRightButton ba_button_setButtonLayoutType:BAKit_ButtonLayoutTypeCenterImageRight padding:padding]; 46 | [self.centerImageRightButton ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomRight viewCornerRadius:viewCornerRadius borderWidth:2.0f borderColor:BAKit_Color_RandomRGB_pod()]; 47 | 48 | [self.centerImageTopButton ba_button_setButtonLayoutType:BAKit_ButtonLayoutTypeCenterImageTop padding:padding]; 49 | [self.centerImageTopButton ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeTopLeftAndTopRight viewCornerRadius:viewCornerRadius * 2]; 50 | 51 | [self.centerImageBottomButton ba_button_setButtonLayoutType:BAKit_ButtonLayoutTypeCenterImageBottom padding:padding]; 52 | [self.centerImageBottomButton ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomRightAndTopRightAndTopLeft viewCornerRadius:viewCornerRadius * 2 borderWidth:2.0f borderColor:BAKit_Color_RandomRGB_pod()]; 53 | 54 | [self.leftImageLeftButton ba_button_setButtonLayoutType:BAKit_ButtonLayoutTypeLeftImageLeft padding:padding]; 55 | self.leftImageLeftButton.ba_padding_inset = 20; 56 | [self.leftImageLeftButton ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomLeftAndBottomRight viewCornerRadius:viewCornerRadius borderWidth:2.0f borderColor:BAKit_Color_RandomRGB_pod()]; 57 | 58 | [self.leftImageRightButton ba_button_setButtonLayoutType:BAKit_ButtonLayoutTypeLeftImageRight padding:padding]; 59 | self.leftImageRightButton.ba_padding_inset = 20; 60 | 61 | [self.leftImageRightButton ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomLeftAndTopLeft viewCornerRadius:viewCornerRadius borderWidth:2.0f borderColor:BAKit_Color_RandomRGB_pod()]; 62 | 63 | [self.rightImageLeftButton ba_button_setButtonLayoutType:BAKit_ButtonLayoutTypeRightImageLeft padding:padding]; 64 | [self.rightImageLeftButton ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeBottomRightAndTopRightAndBottomLeft viewCornerRadius:viewCornerRadius]; 65 | 66 | [self.rightImageRightButton ba_button_setButtonLayoutType:BAKit_ButtonLayoutTypeRightImageRight padding:padding]; 67 | [self.rightImageRightButton ba_button_setViewRectCornerType:BAKit_ViewRectCornerTypeAllCorners viewCornerRadius:viewCornerRadius]; 68 | } 69 | 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Example/BAButton/ViewController2.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 40 | 47 | 57 | 64 | 74 | 81 | 88 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /Example/BAButton/ViewController3.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController3.h 3 | // BAButton 4 | // 5 | // Created by 任子丰 on 17/5/25. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController3 : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/BAButton/ViewController3.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController3.m 3 | // BAButton 4 | // 5 | // Created by 任子丰 on 17/5/25. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #import "ViewController3.h" 10 | #import "BAButton.h" 11 | 12 | @interface ViewController3 () 13 | @property (weak, nonatomic) IBOutlet UIButton *btn1; 14 | @property (weak, nonatomic) IBOutlet UIButton *btn2; 15 | @property (weak, nonatomic) IBOutlet UIButton *btn3; 16 | @property (weak, nonatomic) IBOutlet UIButton *btn4; 17 | @property (weak, nonatomic) IBOutlet UIButton *btn5; 18 | @property (weak, nonatomic) IBOutlet UIButton *btn6; 19 | @property (weak, nonatomic) IBOutlet UIButton *btn7; 20 | @property (weak, nonatomic) IBOutlet UIButton *btn8; 21 | @property (weak, nonatomic) IBOutlet UIButton *btn9; 22 | @property (weak, nonatomic) IBOutlet UIButton *countDownBtn; 23 | 24 | @end 25 | 26 | @implementation ViewController3 27 | 28 | - (void)viewDidLoad { 29 | [super viewDidLoad]; 30 | 31 | self.title = @"UIButton State"; 32 | [self test]; 33 | } 34 | 35 | - (void)test { 36 | [self.btn1 ba_buttonSetBackgroundColor:BAKit_Color_RandomRGB_pod() forState:UIControlStateNormal animated:YES]; 37 | [self.btn1 ba_buttonSetBackgroundColor:BAKit_Color_RandomRGB_pod() forState:UIControlStateSelected animated:YES]; 38 | // 不同状态下的阴影效果 39 | [self.btn1 ba_buttonSetRoundShadowWithCornerRadius:0 shadowColor:BAKit_Color_Yellow_pod offset:CGSizeMake(0.6, 0.6) opacity:1 shadowRadius:5 forState:UIControlStateNormal]; 40 | [self.btn1 ba_buttonSetRoundShadowWithCornerRadius:0 shadowColor:BAKit_Color_Red_pod offset:CGSizeMake(0.6, 0.6) opacity:1 shadowRadius:5 forState:UIControlStateSelected]; 41 | 42 | [self.btn2 ba_buttonSetBackgroundColor:BAKit_Color_RandomRGB_pod() forState:UIControlStateNormal animated:NO]; 43 | [self.btn2 ba_buttonSetBackgroundColor:BAKit_Color_RandomRGB_pod() forState:UIControlStateSelected animated:NO]; 44 | 45 | [self.btn3 ba_buttonSetborderColor:BAKit_Color_RandomRGB_pod() forState:UIControlStateNormal animated:YES]; 46 | [self.btn3 ba_buttonSetborderColor:BAKit_Color_RandomRGB_pod() forState:UIControlStateSelected animated:YES]; 47 | self.btn3.layer.borderWidth = 5; 48 | 49 | [self.btn4 ba_buttonSetborderColor:BAKit_Color_RandomRGB_pod() forState:UIControlStateNormal animated:YES]; 50 | [self.btn4 ba_buttonSetborderColor:BAKit_Color_RandomRGB_pod() forState:UIControlStateSelected animated:YES]; 51 | self.btn4.layer.borderWidth = 5; 52 | 53 | [self.btn5 ba_buttonSetTitleLabelFont:[UIFont systemFontOfSize:10] forState:UIControlStateNormal]; 54 | [self.btn5 ba_buttonSetTitleLabelFont:[UIFont systemFontOfSize:12] forState:UIControlStateSelected]; 55 | 56 | [self.btn6 ba_buttonConfigBackgroundColors:@{@(UIControlStateNormal):BAKit_Color_RandomRGB_pod(), 57 | @(UIControlStateSelected):BAKit_Color_RandomRGB_pod()}]; 58 | 59 | [self.btn7 ba_buttonConfigBorderColors:@{@(UIControlStateNormal):BAKit_Color_RandomRGB_pod(), 60 | @(UIControlStateSelected):BAKit_Color_RandomRGB_pod()}]; 61 | self.btn7.layer.borderWidth = 5; 62 | 63 | [self.btn8 ba_buttonConfigTitleLabelFont:@{@(UIControlStateNormal):[UIFont systemFontOfSize:10], 64 | @(UIControlStateSelected):[UIFont systemFontOfSize:12]}]; 65 | } 66 | 67 | - (IBAction)btnClick:(UIButton *)sender { 68 | // 添加按钮点击音效和震动效果 69 | // [sender ba_buttonPlaySoundEffectWithFileName:@"failure.mp3" isNeedShock:YES]; 70 | sender.selected = !sender.isSelected; 71 | } 72 | 73 | - (IBAction)countDownClick:(UIButton *)sender { 74 | // sender.userInteractionEnabled = NO; 75 | __block UIButton *btn = sender; 76 | [sender ba_countDownCustomWithTimeInterval:5 block:^(NSInteger currentTime) { 77 | // 此处是可以自由定制 title 和 image 78 | NSString *title = [NSString stringWithFormat:@"Countdown_0%ld", (long)currentTime]; 79 | dispatch_async(dispatch_get_main_queue(), ^{ 80 | [btn setTitle:nil forState:UIControlStateNormal]; 81 | [btn setBackgroundImage:BAKit_ImageName(title) forState:UIControlStateNormal]; 82 | }); 83 | }]; 84 | 85 | [sender setTimeStoppedCallback:^{ 86 | [btn setTitle:@"倒计时" forState:UIControlStateNormal]; 87 | }]; 88 | } 89 | 90 | - (IBAction)skipClick:(UIButton *)sender { 91 | // __block UIButton *btn = sender; 92 | [sender ba_countDownWithTimeInterval:5 countDownFormat:nil endTitle:@"重新发送"]; 93 | // [sender setTimeStoppedCallback:^{ 94 | // [btn setTitle:@"跳过" forState:UIControlStateNormal]; 95 | // }]; 96 | } 97 | 98 | - (void)dealloc { 99 | NSLog(@"释放了"); 100 | } 101 | 102 | 103 | @end 104 | -------------------------------------------------------------------------------- /Example/BAButton/ViewController3.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 43 | 53 | 64 | 78 | 89 | 99 | 113 | 124 | 135 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /Example/BAButton/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/BAButton/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // BAButton 4 | // 5 | // Created by boai on 11/15/2018. 6 | // Copyright (c) 2018 boai. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | #import "BAAppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([BAAppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'BAButton_Example' do 4 | pod 'BAButton', :path => '../' 5 | 6 | target 'BAButton_Tests' do 7 | inherit! :search_paths 8 | 9 | 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - BAButton (2.6.7) 3 | 4 | DEPENDENCIES: 5 | - BAButton (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | BAButton: 9 | :path: "../" 10 | 11 | SPEC CHECKSUMS: 12 | BAButton: 04612a37b697d2978fff18de7d04963a045230b8 13 | 14 | PODFILE CHECKSUM: 932ca8088ecdad49b16a4b19f32648c22cd994b4 15 | 16 | COCOAPODS: 1.6.0.beta.2 17 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/BAButton.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "BAButton", 3 | "version": "2.6.7", 4 | "summary": "自定义 button 类!用分类全新重构 BAButton,代码配置更灵活!可以自由设置 button 的文字和图片的布局、间距、每个角的切圆角!", 5 | "description": "TODO: Add long description of the pod here.", 6 | "homepage": "https://github.com/BAHome/BAButton", 7 | "license": { 8 | "type": "MIT", 9 | "file": "LICENSE" 10 | }, 11 | "authors": { 12 | "boai": "sunboyan@outlook.com" 13 | }, 14 | "source": { 15 | "git": "https://github.com/BAHome/BAButton.git", 16 | "tag": "2.6.7" 17 | }, 18 | "platforms": { 19 | "ios": "8.0" 20 | }, 21 | "source_files": "BAButton/**/*.{h,m}", 22 | "public_header_files": "Pod/Classes/**/*.h", 23 | "frameworks": [ 24 | "UIKit", 25 | "Foundation" 26 | ], 27 | "requires_arc": true 28 | } 29 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - BAButton (2.6.7) 3 | 4 | DEPENDENCIES: 5 | - BAButton (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | BAButton: 9 | :path: "../" 10 | 11 | SPEC CHECKSUMS: 12 | BAButton: 04612a37b697d2978fff18de7d04963a045230b8 13 | 14 | PODFILE CHECKSUM: 932ca8088ecdad49b16a4b19f32648c22cd994b4 15 | 16 | COCOAPODS: 1.6.0.beta.2 17 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcuserdata/Alria.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BAButton.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 1 11 | 12 | Pods-BAButton_Example.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 2 16 | 17 | Pods-BAButton_Tests.xcscheme_^#shared#^_ 18 | 19 | orderHint 20 | 3 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcuserdata/sunboyan.xcuserdatad/xcschemes/BAButton.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcuserdata/sunboyan.xcuserdatad/xcschemes/Pods-BAButton_Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 52 | 53 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcuserdata/sunboyan.xcuserdatad/xcschemes/Pods-BAButton_Tests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 52 | 53 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcuserdata/sunboyan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BAButton.xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 0 13 | 14 | Pods-BAButton_Example.xcscheme 15 | 16 | isShown 17 | 18 | orderHint 19 | 2 20 | 21 | Pods-BAButton_Tests.xcscheme 22 | 23 | isShown 24 | 25 | orderHint 26 | 3 27 | 28 | 29 | SuppressBuildableAutocreation 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/BAButton/BAButton-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/BAButton/BAButton-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_BAButton : NSObject 3 | @end 4 | @implementation PodsDummy_BAButton 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/BAButton/BAButton-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/BAButton/BAButton-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "BAButton.h" 14 | #import "BAButton_Version.h" 15 | #import "BAKit_ConfigurationDefine.h" 16 | #import "UIButton+BACountDown.h" 17 | #import "UIButton+BAKit.h" 18 | #import "UIButton+BAState.h" 19 | #import "UIView+BARectCorner.h" 20 | 21 | FOUNDATION_EXPORT double BAButtonVersionNumber; 22 | FOUNDATION_EXPORT const unsigned char BAButtonVersionString[]; 23 | 24 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/BAButton/BAButton.modulemap: -------------------------------------------------------------------------------- 1 | framework module BAButton { 2 | umbrella header "BAButton-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/BAButton/BAButton.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/BAButton 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "UIKit" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Example/Pods-BAButton_Example-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Example/Pods-BAButton_Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## BAButton 5 | 6 | Copyright (c) 2018 boai 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | Generated by CocoaPods - https://cocoapods.org 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Example/Pods-BAButton_Example-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2018 boai <sunboyan@outlook.com> 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | BAButton 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Generated by CocoaPods - https://cocoapods.org 47 | Title 48 | 49 | Type 50 | PSGroupSpecifier 51 | 52 | 53 | StringsTable 54 | Acknowledgements 55 | Title 56 | Acknowledgements 57 | 58 | 59 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Example/Pods-BAButton_Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_BAButton_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_BAButton_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Example/Pods-BAButton_Example-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | 23 | # Used as a return value for each invocation of `strip_invalid_archs` function. 24 | STRIP_BINARY_RETVAL=0 25 | 26 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 27 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 28 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 29 | 30 | # Copies and strips a vendored framework 31 | install_framework() { 32 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 33 | local source="${BUILT_PRODUCTS_DIR}/$1" 34 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 35 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 36 | elif [ -r "$1" ]; then 37 | local source="$1" 38 | fi 39 | 40 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 41 | 42 | if [ -L "${source}" ]; then 43 | echo "Symlinked..." 44 | source="$(readlink "${source}")" 45 | fi 46 | 47 | # Use filter instead of exclude so missing patterns don't throw errors. 48 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 49 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 50 | 51 | local basename 52 | basename="$(basename -s .framework "$1")" 53 | binary="${destination}/${basename}.framework/${basename}" 54 | 55 | if ! [ -r "$binary" ]; then 56 | binary="${destination}/${basename}" 57 | elif [ -L "${binary}" ]; then 58 | echo "Destination binary is symlinked..." 59 | dirname="$(dirname "${binary}")" 60 | binary="${dirname}/$(readlink "${binary}")" 61 | fi 62 | 63 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 64 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 65 | strip_invalid_archs "$binary" 66 | fi 67 | 68 | # Resign the code if required by the build settings to avoid unstable apps 69 | code_sign_if_enabled "${destination}/$(basename "$1")" 70 | 71 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 72 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 73 | local swift_runtime_libs 74 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 75 | for lib in $swift_runtime_libs; do 76 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 77 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 78 | code_sign_if_enabled "${destination}/${lib}" 79 | done 80 | fi 81 | } 82 | 83 | # Copies and strips a vendored dSYM 84 | install_dsym() { 85 | local source="$1" 86 | if [ -r "$source" ]; then 87 | # Copy the dSYM into a the targets temp dir. 88 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 89 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 90 | 91 | local basename 92 | basename="$(basename -s .framework.dSYM "$source")" 93 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 94 | 95 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 96 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 97 | strip_invalid_archs "$binary" 98 | fi 99 | 100 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 101 | # Move the stripped file into its final destination. 102 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 103 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" else 104 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 105 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 106 | fi 107 | fi 108 | } 109 | 110 | # Signs a framework with the provided identity 111 | code_sign_if_enabled() { 112 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 113 | # Use the current code_sign_identity 114 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 115 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 116 | 117 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 118 | code_sign_cmd="$code_sign_cmd &" 119 | fi 120 | echo "$code_sign_cmd" 121 | eval "$code_sign_cmd" 122 | fi 123 | } 124 | 125 | # Strip invalid architectures 126 | strip_invalid_archs() { 127 | binary="$1" 128 | # Get architectures for current target binary 129 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 130 | # Intersect them with the architectures we are building for 131 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 132 | # If there are no archs supported by this binary then warn the user 133 | if [[ -z "$intersected_archs" ]]; then 134 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 135 | STRIP_BINARY_RETVAL=0 136 | return 137 | fi 138 | stripped="" 139 | for arch in $binary_archs; do 140 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 141 | # Strip non-valid architectures in-place 142 | lipo -remove "$arch" -output "$binary" "$binary" 143 | stripped="$stripped $arch" 144 | fi 145 | done 146 | if [[ "$stripped" ]]; then 147 | echo "Stripped $binary of architectures:$stripped" 148 | fi 149 | STRIP_BINARY_RETVAL=1 150 | } 151 | 152 | 153 | if [[ "$CONFIGURATION" == "Debug" ]]; then 154 | install_framework "${BUILT_PRODUCTS_DIR}/BAButton/BAButton.framework" 155 | fi 156 | if [[ "$CONFIGURATION" == "Release" ]]; then 157 | install_framework "${BUILT_PRODUCTS_DIR}/BAButton/BAButton.framework" 158 | fi 159 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 160 | wait 161 | fi 162 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Example/Pods-BAButton_Example-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_BAButton_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_BAButton_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Example/Pods-BAButton_Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BAButton" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BAButton/BAButton.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "BAButton" -framework "Foundation" -framework "UIKit" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Example/Pods-BAButton_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_BAButton_Example { 2 | umbrella header "Pods-BAButton_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Example/Pods-BAButton_Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BAButton" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BAButton/BAButton.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "BAButton" -framework "Foundation" -framework "UIKit" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Tests/Pods-BAButton_Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Tests/Pods-BAButton_Tests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Tests/Pods-BAButton_Tests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Tests/Pods-BAButton_Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_BAButton_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_BAButton_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Tests/Pods-BAButton_Tests-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_BAButton_TestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_BAButton_TestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Tests/Pods-BAButton_Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BAButton" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BAButton/BAButton.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "BAButton" -framework "Foundation" -framework "UIKit" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Tests/Pods-BAButton_Tests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_BAButton_Tests { 2 | umbrella header "Pods-BAButton_Tests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-BAButton_Tests/Pods-BAButton_Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BAButton" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BAButton/BAButton.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "BAButton" -framework "Foundation" -framework "UIKit" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Images/BAButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Images/BAButton.png -------------------------------------------------------------------------------- /Images/BAButton1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Images/BAButton1.png -------------------------------------------------------------------------------- /Images/BAButton2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Images/BAButton2.png -------------------------------------------------------------------------------- /Images/BAButton3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAButton/d82da04b60a9afe1b8b62cf6a69160ef98899489/Images/BAButton3.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 boai 2 | 3 | 996 License Version 1.0 (Draft) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE_CN: -------------------------------------------------------------------------------- 1 | 版权所有(c)<年份><版权持有人> 2 | 3 | 反996许可证版本1.0 4 | 5 | 在符合下列条件的情况下,特此免费向任何得到本授权作品的副本(包括源代码、文件和/或相关内容,以下 6 | 统称为“授权作品”)的个人和法人实体授权:被授权个人或法人实体有权以任何目的处置授权作品,包括但 7 | 不限于使用、复制,修改,衍生利用、散布,发布和再许可: 8 | 9 | 10 | 1. 个人或法人实体必须在许可作品的每个再散布或衍生副本上包含以上版权声明和本许可证,不得自行修 11 | 改。 12 | 2. 个人或法人实体必须严格遵守与个人实际所在地或个人出生地或归化地、或法人实体注册地或经营地 13 | (以较严格者为准)的司法管辖区所有适用的与劳动和就业相关法律、法规、规则和标准。如果该司法管辖 14 | 区没有此类法律、法规、规章和标准或其法律、法规、规章和标准不可执行,则个人或法人实体必须遵守国 15 | 际劳工标准的核心公约。 16 | 3. 个人或法人不得以任何方式诱导或强迫其全职或兼职员工或其独立承包人以口头或书面形式同意直接或 17 | 间接限制、削弱或放弃其所拥有的,受相关与劳动和就业有关的法律、法规、规则和标准保护的权利或补救 18 | 措施,无论该等书面或口头协议是否被该司法管辖区的法律所承认,该等个人或法人实体也不得以任何方法 19 | 限制其雇员或独立承包人向版权持有人或监督许可证合规情况的有关当局报告或投诉上述违反许可证的行为 20 | 的权利。 21 | 22 | 该授权作品是"按原样"提供,不做任何明示或暗示的保证,包括但不限于对适销性、特定用途适用性和非侵 23 | 权性的保证。在任何情况下,无论是在合同诉讼、侵权诉讼或其他诉讼中,版权持有人均不承担因本软件或 24 | 本软件的使用或其他交易而产生、引起或与之相关的任何索赔、损害或其他责任。 25 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------