PREBorderView
一个用于指定单边边框的非常简单的 Objective-C UIView
分类。
安装
使用 CocoaPods
CocoaPods 是一个用于 Objective-C 的依赖管理器,它可以自动化并简化在项目中使用第三方库(如 PREBorderView
)的过程。
Podfile
pod 'PREBorderView', "~> 3.3"
用户手册
否则只需将 UIView+PREBorderView.{h,m}
添加到您的项目中。
用法
为视图添加边框
[view addBorderWithColor:UIColor.blackColor andWidth:2 atPosition:PREBorderPositionRight];
移除边框
[view removeBorderAtPosition:PREBorderPositionRight];
defaultBorderColor
为了方便使用,您可以指定一个 defaultBorderColor
。
addBorderWithWidth:atPosition
addRetinaPixelBorderAtPosition
使用 defaultBorderColor
添加边框
响应用户尺寸变化
为了轻松更新所有边框以适应视图的尺寸变化
- 使用
layoutBorders
更新视图的边框。 - 使用
layoutSubviewBorders
更新视图的边框以及所有子视图的边框。
为了响应自动布局的变化更新控制器视图,请在 viewDidLayoutSubviews
中调用 layoutSubviewBorders
。
完整文档
通讯
- 如果你 发现了一个错误,并且可以提供可靠重复的步骤,请提交一个issue。
- 如果你 有功能请求,请提交一个issue。
- 如果你 想要贡献,请提交一个pull request。
授权协议
PREBorderView遵循MIT授权协议。详情请见LICENSE
文件。