首页 > 代码库 > ios App textField placeholder 信息上浮
ios App textField placeholder 信息上浮
textField placeholder 提示信息上浮
当输入框 有文的时候 placeholder 信息就浮动到左上角。
只要继承就行,不用附加调用代码, 使用非常简单。
tintFloatField
代码调用非常简单
#import "RPFloatingPlaceholderTextField.h" #import "RPFloatingPlaceholderTextView.h" @interface ViewController () @property (weak, nonatomic) IBOutlet RPFloatingPlaceholderTextField *titleField; @property (weak, nonatomic) IBOutlet RPFloatingPlaceholderTextField *detailField; @property (weak, nonatomic) IBOutlet RPFloatingPlaceholderTextField *localField; @property (weak, nonatomic) IBOutlet RPFloatingPlaceholderTextField *cityField; @property (weak, nonatomic) IBOutlet RPFloatingPlaceholderTextView *describeTextView; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.titleField.floatingLabelActiveTextColor = [UIColor redColor]; self.titleField.floatingLabelInactiveTextColor = [UIColor blueColor]; self.detailField.floatingLabelActiveTextColor = [UIColor redColor]; self.detailField.floatingLabelInactiveTextColor = [UIColor blueColor]; self.localField.floatingLabelActiveTextColor = [UIColor redColor]; self.localField.floatingLabelInactiveTextColor = [UIColor blueColor]; self.cityField.floatingLabelActiveTextColor = [UIColor redColor]; self.cityField.floatingLabelInactiveTextColor = [UIColor blueColor]; self.describeTextView.placeholder = @"describe"; self.describeTextView.floatingLabelActiveTextColor = [UIColor redColor]; self.describeTextView.floatingLabelInactiveTextColor = [UIColor blueColor]; self.describeTextView.layer.borderColor = [UIColor blackColor].CGColor; self.describeTextView.layer.borderWidth = 1; } @end
github 地址:https://github.com/lc081200/tintFloatField
ios App textField placeholder 信息上浮
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。