UITextSubClass 1.0.3

UITextSubClass 1.0.3

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2022年4月

azuakuraru维护。




  • azu

UITextSubClass Build Status

此库是UIText(视图|字段)子类的集合。

  • 众多子类
  • 支持iPad(

安装

CocoaPods

pod 'UITextSubClass', :git => 'https://github.com/azu/UITextSubClass.git'

如果您只想使用其中一个组件,请安装对应的子规格。

pod 'UITextSubClass/UITextFieldWithDatePicker'

UI组件摘要

img img

UITextFieldWithPicker

UITextField + UIPickerView.

UITextFieldWithDatePicker

UITextField + UIDatePicker.

UITextFieldWithDecimalPad

UITextField + keyboardType = UIKeyboardTypeDecimalPad + 处理小数点。

您必须设置 significantFigures

@property (nonatomic) NSUInteger significantFigures;

UITextFieldWithNumberPad

UITextField + keyboardType = UIKeyboardTypeNumberPad + 输入控件。

UITextFieldWithToolbar

UITextField + UIToolbar(inputAccessoryView)

UITextViewWithPlaceholder

UITextView + 占位符 + 层自定义

#pragma mark - user defined runtime attributes
@property(nonatomic, strong) NSString *placeholderText;
@property(nonatomic, strong) UIColor *placeholderColor;
@property(nonatomic, strong) UILabel *placeholder;

// Those Property would only work with Storyboard - iOS5
@property(nonatomic, strong) UIColor *borderColor; // Color
@property(nonatomic, strong) UIColor *shadowColor; // Color
@property(nonatomic, strong) NSString *shadowOpacity; // Number (available decimal) eg. 1 or 0.5
@property(nonatomic, strong) NSString *borderWidth; // Number (available decimal) eg. 1 or 0.5
@property(nonatomic, strong) NSString *cornerRadius; // Number (available decimal) eg. 1 or 0.5
@property(nonatomic, strong) NSString *shadowRadius; // Number (available decimal) eg. 1 or 0.5
@property(nonatomic, strong) NSValue *shadowOffset; // CGSize

UITextViewWithToolbar

UITextViewWithPlaceholder + 工具栏

使用方法

UITextFieldWithDatePicker

UITextFieldWithDatePicker 是 UITextField 的子类

UITextFieldWithDatePicker *dateTextField = [[UITextFieldWithDatePicker alloc]init];
dateTextField.myDelegate = self;
// set DatePicker type
dateTextField.datePickerMode = UIDatePickerModeDate;

如果设置了 UIDatePickerModeTime,还应该设置默认分钟间隔

dateTextField.minuteInterval = 60; // default minuteInterval

可以传递原始 UIDateFormatter: (默认使用 dateFormatFromTemplate:)

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
dateTextField.dateFormatter = dateFormatter;

手动更新 TextField

[dateTextField updateText];

获取选择的日期

[dateTextField inputedDate];// <NSDate>

贡献

  1. 分叉项目!
  2. 创建您的功能分支: git checkout -b my-new-feature
  3. 提交您的更改: git commit -am 'Add some feature'
  4. 推送到分支: git push origin my-new-feature
  5. 提交拉取请求 :D

许可协议

MIT