UITextField * searchTextFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, 0, textView.width-20, 30)];
searchTextFiled.delegate =self;
searchTextFiled.backgroundColor = [UIColor clearColor];
searchTextFiled.textColor = [UIColor blackColor];
searchTextFiled.font = [UIFont systemFontOfSize:13];
searchTextFiled.returnKeyType = UIReturnKeySearch;
searchTextFiled.textAlignment = NSTextAlignmentCenter;
searchTextFiled.tintColor = main_Color;
[textView addSubview:searchTextFiled];
NSMutableParagraphStyle *style = [searchTextFiled.defaultTextAttributes[NSParagraphStyleAttributeName] mutableCopy];
style.minimumLineHeight = searchTextFiled.font.lineHeight - (searchTextFiled.font.lineHeight - [UIFont systemFontOfSize:13.0].lineHeight) / 2.0;
searchTextFiled.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"点击搜索群组" attributes:@{NSForegroundColorAttributeName:line_Color,NSFontAttributeName : [UIFont systemFontOfSize:13.0], NSParagraphStyleAttributeName : style}];
UItextField占位符在中间
最新推荐文章于 2018-11-11 21:04:51 发布