Я хочу создать собственный TableViewCell, на котором я хочу иметь UITextField с возможностью редактирования. Итак, я создал новый класс с помощью xib. Добавьте элемент TableViewCell. Перетащите на него UITextField. Добавил розетки в свой класс и соединил их все вместе. В моем методе TableView cellForRowAtIndexPath я создаю свои настраиваемые ячейки, НО они не являются моими настраиваемыми ячейками - это просто обычные ячейки. Как я могу решить эту проблему и почему? thanx!
// EditCell. h
#import <UIKit/UIKit.h>
@interface EditCell : UITableViewCell
{
IBOutlet UITextField *editRow;
}
@property (nonatomic, retain) IBOutlet UITextField *editRow;
@end
// EditCell.m
#import "EditCell.h"
@implementation EditCell
@synthesize editRow;
#pragma mark -
#pragma mark View lifecycle
- (void)viewDidUnload
{
// Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
// For example: self.myOutlet = nil;
self.editRow = nil;
}
@end
// в моем коде
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"EditCell";
EditCell *cell = (EditCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[EditCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier] autorelease];
}
cell.editRow.text = @"some text to test";
return cell;
}