iOSKickStart
示例
要运行示例项目,请克隆仓库,并首先从 Example 目录运行 pod install
关于
一个美妙的项目模板,用于启动任何 iOS 项目。目标是避免重复编码,比如 UIView 圆角设计或简单的滚动表单。请向此项目贡献力量,以丰富标准功能集合。
功能及实现
1. 交叉溶解和逆向推送弹出导航。
2. 使用十六进制值初始化UIColor。
3. UIView的Corner Radius和Colored Border IBInspectables。
4. 使用Interface Builder中的键字符串进行文本本地化。
5. 定义一次,到处使用的全局常量。
6. NavigationController的isNavBarHidden IBInspectable。
7. Scrollview actAsInputForm IBInspectable。
8. 通过启用UIView扩展变量endEditingOnTap在点击时消失键盘。
9. 在Interface Builder中使用默认键盘配置枚举,轻松选择并避免配置错误。
10. UITextField 左右内边距
或者
textField.leftPadding = 8.0
textField.rightPadding = 8.0
11. UIButton 可适应字体大小
或者
button.fontToHeightRatio = 0.35
button.numberOfLines = 1
button.adjustFontSize = true
12. 代码输入 TextField
演示
实现
或者
textField.codeLengthAndChar = "4,●"
与
// MARK: - UITextFieldDelegate
func textFieldDidBeginEditing(_ textField: UITextField) {
if let textFld = (textField as? TextField), let _ = textFld.codeLength {
textFld.observeCodeInputDidBegin()
}
}
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if let textFld = (textField as? TextField), let _ = textFld.codeLength {
return textFld.observeCodeInput(shouldChangeCharactersIn: range, replacementString: string)
}
return true
}
13. UILabel bounds.height 字体大小比
或者
label.fontToHeightRatio = 0.6
14. UIViewController titleImage IBInspectable
或者
viewController.titleImage = UIImage(named: "image_name")
限制
- 您必须扩展或使用此处声明的子类,而不是 Apple 的基本类。
这只是个基础工作。请贡献,扩展并享受...
安装
iOSKickStart 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "iOSKickStart"
作者
Twaha Mukammel, [email protected]
许可协议
GetStartiOS 在MIT协议下可用。查看 License 文件获取更多信息。