UITextField

//
UITextField*textf = [[UITextField alloc] initWithFrame:CGRectMake(topimg.x + topimg.width + topimg.width/2,0, textfww, bgView.height)];
【UITextField】textf.delegate=self;
textf.tag = textfTag;
textf.backgroundColor = [UIColor clearColor];
textf.autocorrectionType = UITextAutocorrectionTypeNo;
textf.autocapitalizationType = UITextAutocapitalizationTypeNone;
textf.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
//textf.borderStyle = UITextBorderStyleRoundedRect; // 设置圆角边框
// 设置提示文字的颜色
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"placeholderStr" attributes:@{NSForegroundColorAttributeName:JFSCBrownColor1, NSFontAttributeName:textf.font}];
textf.attributedPlaceholder= attrString;
//textf.placeholder = placeholderStr; //设置默认的文本显示
textf.font=Font15;
textf.clearsOnBeginEditing = YES; //再次编辑就清空
textf.keyboardType = keyboardTypeNub; //数字键盘 UIKeyboardTypeNumberPad 默认:UIKeyboardTypeDefault
textf.clearButtonMode = UITextFieldViewModeUnlessEditing; //编辑时不出现,编辑后才出现清除按钮
[textfbecomeFirstResponder]; //使文本框在界面打开时就获取焦点,并弹出输入键盘
[textfresignFirstResponder]; //使文本框失去焦点,并收回键盘
textf.secureTextEntry = issecureTextEntry; //暗纹
[bgViewaddSubview:textf];

    推荐阅读