iOS-UITextField模仿在线编辑框

UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(15, 0, self.view.frame.size.width-50-10, 50)];
            self.nameTextField = textField;
            textField.backgroundColor = [UIColor clearColor];
            textField.borderStyle = UITextBorderStyleNone;
            //textField.placeholder = @"请输入您的电话";
            NSAttributedString* timesText =[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"qasnas"]]; // 设置文字
            [textField setAttributedText:timesText];
            textField.keyboardType = UIKeyboardTypeNumberPad;
            textField.clearButtonMode = UITextFieldViewModeWhileEditing;
            textField.delegate = self;
            [cell.contentView addSubview:textField];

你可能感兴趣的:(iOS-UITextField模仿在线编辑框)