I've used UITextfield inside Tableview's cell using the following code:
- (UITextField *)textFieldWithDefaultsForCell:(int)cellIdentifier {
UITextField *textField = [[[UITextField alloc] initWithFrame:CGRectMake(180, 12, 135, 20)] autorelease];
textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
textField.delegate = self;
textField.textColor = [UIColor colorWithRed:66.0/225.0 green:77.0/255.0 blue:103.0/255.0 alpha:1.0];
textField.returnKeyType = UIReturnKeyDone;
textField.tag = cellIdentifier;
textField.placeholder = @"Enter text";
textField.contentVerticalAlignment = UIControlContentVerticalAlignmentBottom;
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
return textField;
}
and then,
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
....
....
switch (indexPath.row) {
case EmailAddressCellIdentifier:
cell.textLabel.text = @"Email Address";
textField.keyboardType = UIKeyboardTypeEmailAddress;
textField.text = configurator.emailAddress;
[emailAddressField release];
emailAddressField = [textField retain];
[cell.contentView addSubview:textField];
break;
....
....
}
Now, please see the following image:
In the email box, I was typing abcdef-123456789... But the view is stuck. It doesn't move to right and I can't see the rest of the text (6789...). I can only see abcdef-12345
Can you please tell me, where is the error?