
UITextField UITextView 输入框
小手一背爱谁谁
这个作者很懒,什么都没留下…
展开
-
iOS利用storyboard修改UITextField的placeholder文字颜色
最近有个需求需要修改UITextField的placeholder文字颜色,在网上找发现有用代码修改的,但是考虑到更加优雅的实现,所以尝试着在storyboard中直接实现,结果竟然真的成功了(原谅我太小白),实现的位置如下:具体步骤:1.在User Defined Runtime Attributes中添加一个Key。2.输入Key Path(这里我们输入_placehold原创 2015-10-14 11:35:37 · 335 阅读 · 0 评论 -
iOS 关闭textField的粘贴 选择 全选等对内容操作的菜单
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {// if (action == @selector(paste:))//禁止粘贴// return NO;// if (action == @selector(select:))// 禁止选择// return NO;原创 2016-10-15 14:14:43 · 4268 阅读 · 0 评论 -
iOS 输入框过滤emoji表情
// 通过创建一个NSString 的category类目实现最后输入的表情的过滤 输入框粘贴功能需要关闭也就是只能输入关闭输入框粘贴功能点击此链接+ (BOOL)isContainsTwoEmoji:(NSString *)string{ __blockBOOL isEomji =NO; [stringenumerateSubstringsInRange:NSMa...原创 2016-11-02 17:16:24 · 2691 阅读 · 0 评论 -
iOS textView的emoji表情过滤
// 类型- (void)textViewDidChange:(UITextView *)textView{ NSRange textRange = [textViewselectedRange]; [textView setText:[selfdisable_emoji:[textView text]]]; [textView原创 2016-11-02 17:28:36 · 1558 阅读 · 0 评论 -
iOS 键盘遮挡输入框解决方案
- (void)addNotification {[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];[[NSNotificationCenter原创 2016-12-21 14:30:28 · 2559 阅读 · 0 评论 -
iOS 输入框字数限制
[_number addTarget:self action:@selector(numberAgaintextFieldDidChange:) forControlEvents:UIControlEventEditingChanged];- (void)textViewDidChange:(UITextView *)textView { NSInteger number ...原创 2017-01-06 17:08:18 · 413 阅读 · 0 评论 -
iOS 快速创建控件
#import #import @interface QuickBuild : NSObject/** 创建UILabel */+ (UILabel *)quickBuildLableWithFrame:(CGRect)frame text:(NSString *)text原创 2017-09-12 13:11:18 · 414 阅读 · 0 评论 -
iOS 直接改变控件x.y.width.height
#import @interface UIView (Frame)@property (nonatomic,assign) CGFloat x;@property (nonatomic,assign) CGFloat y;@property (nonatomic,assign) CGFloat width;@property (non原创 2017-09-12 13:19:32 · 2000 阅读 · 0 评论 -
iOS textView添加placeHolder
// _placeholderLabel UILabel *placeHolderLabel = [[UILabel alloc] init]; placeHolderLabel.text = @"请输入内容"; placeHolderLabel.numberOfLines = 0; placeHolderLabel.textColor = [UIColor li...原创 2018-10-21 01:07:53 · 2850 阅读 · 1 评论 -
ios 弹出键盘 顶端navigationbar 会上移
是因为使用了IQKeyBoardManager 问题加上这段代码解决-(void)loadView { UIScrollView *scView = [[UIScrollView alloc]initWithFrame:[UIScreen mainScreen].bounds]; self.view = scView;}原创 2016-02-02 15:40:06 · 4837 阅读 · 3 评论 -
iOS 输入框弹出键盘后改变tableView高度内容不被遮挡
// 键盘弹出改变tableview高度- (void)registerKeybordNotification { NSNotificationCenter *notification = [NSNotificationCenterdefaultCenter]; [notification removeObserver:self]; [原创 2016-10-10 17:27:33 · 2050 阅读 · 0 评论 -
iOS textView光标位置输入以及删除字符或者emoji表情(自定义键盘的删除方法)
/** * 光标位置输入 * * @param emoji 要输入的内容emoji和字符 */- (void)insertStringWithGuangBiaotext:(UITextView *)textView emoji:(NSString *)emoji { NSRange range = textView.selectedRange; NS...原创 2016-08-24 11:10:12 · 6820 阅读 · 2 评论 -
ios开发uitextfield怎么设置行数
//初始化textfield并设置位置及大小 UITextField *text = [[UITextField alloc]initWithFrame:CGRectMake(20, 20, 130, 30)]; //设置边框样式,只有设置了才会显示边框样式 text.borderStyle = UITextBorderStyleRoundedRect; typedef e...原创 2015-10-14 11:34:55 · 6028 阅读 · 0 评论 -
UITextField 键盘挡住输入框 输入内容限制 设定
[_useRregistered addTarget:self action:@selector(useRregisteredtextFieldDidChange:) forControlEvents:UIControlEventEditingChanged];[_passwordregistered addTarget:self action:@selector(passwordregi原创 2015-12-11 10:36:04 · 488 阅读 · 0 评论 -
UITextField判断用户输入是否为邮箱
//判断用户输入是否为邮箱- (BOOL) validateEmail: (NSString *) candidate { NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; NSPredicate *emailTest = [NSPredicate predicateWit原创 2015-12-11 10:34:41 · 740 阅读 · 0 评论 -
iOS邮箱正则表达式
//判断用户输入是否为邮箱- (BOOL) validateEmail: (NSString *) candidate { NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; NSPredicate *emailTest = [NSPredicate predicateWit原创 2015-12-18 18:37:25 · 331 阅读 · 0 评论 -
IOS UITextField常用的代理方法总结
1.//当用户全部清空的时候的时候 会调用-(BOOL)textFieldShouldClear:(UITextField *)textField;2.//可以得到用户输入的字符-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:原创 2015-12-25 13:17:42 · 856 阅读 · 0 评论 -
[iPhone开发]UITextField下拉框的实现
#import@interfaceDropDownList:UIView{ UITextField* textField; //文本输入框 NSArray* list; //下拉列表数据 BOOLshowList; //是否弹出下拉列表 UITableView*listView;原创 2015-12-25 13:24:48 · 2495 阅读 · 0 评论 -
iOS UITextField文字输入监听事件
[textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];- (void) textFieldDidChange:(UITextField *) TextField{}原创 2016-03-21 17:35:34 · 1187 阅读 · 0 评论 -
iOS 去掉首尾空格和换行符
NSString *str = _textView.text; str = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; //去除掉首尾的空白字符和换行字符 str = [str stringByReplacingOccurrencesO...原创 2016-08-31 14:05:32 · 5747 阅读 · 0 评论 -
iOS 实现短信验证码方框输入样式带光标闪烁效果
#import <UIKit/UIKit.h>NS_ASSUME_NONNULL_BEGINtypedef void (^ResultBlock)(NSString *str , NSDictionary *dic,BOOL isOK);@interface StepField : UIView- (instancetype)initWithFrame:(CGRect)fr...原创 2019-04-16 16:25:27 · 2036 阅读 · 0 评论