Как создать UITableViewCell с текстовым полем и кнопкой. Я попытался с этим кодом, но кнопка невидима, а текстовое поле - нет.Создать UITableViewCell с текстовым полем и кнопкой?
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierWithTextBox];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifierWithTextBox] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
CGRect textRect = CGRectMake(10, 20, 500, 31);
UITextField *myfield = [[UITextField alloc]initWithFrame:textRect];
myfield.borderStyle = UITextBorderStyleRoundedRect;
myfield.font = [UIFont systemFontOfSize:22.0];
myfield.adjustsFontSizeToFitWidth = YES;
myfield.minimumFontSize = 2.0;
myfield.clearButtonMode = UITextFieldViewModeWhileEditing;
myfield.keyboardType = UIKeyboardTypeDefault;
myfield.autocorrectionType= UITextAutocorrectionTypeNo;
myfield.autocapitalizationType=UITextAutocapitalizationTypeNone;
myfield.returnKeyType=UIReturnKeyDone;
UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
doneButton.frame = CGRectMake(520, 10, 30, 30); // position in the parent view and set the size of the button
[doneButton setTitle:@"Registry now" forState:UIControlStateNormal];
// add targets and actions
[doneButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
// add to a view
[cell.contentView addSubview: myfield];
[cell.contentView addSubview: doneButton];
[doneButton release];
[myfield release];
}
Забудьте! Я кодирую ipad. Извини за это! – 9891541