У меня есть UITableVIew
. Теперь я сделал свой собственный UITableViewCell
. Но если в моей таблице ничего не отображается. Однако ячейки по-прежнему можно выбрать и открыть DetailView
. Какую команду я забыл?UITableViewCell не отображается в моей таблице
//Customize the appearance of table view cells.
-(UITableViewCell *)tableView: (UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"MainTableCell";
MainTableCell *cell = (MainTableCell*)[tableView dequeueReusableCellWithIdentifier:Cel lIdentifier];
if (cell == nil) {
cell = [[[MainTableCell alloc] initWithStyle:UITableViewCellStyleDef ault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
VerwaltungInformation *selectedFormel = [listOfFormularies objectAtIndex:indexPath.row];
cell.FormelNameLabel.text = selectedFormel.nameFormel;
return cell;
}
Должен ли я добавлять специальные предметы? Если кому-то нужно больше кода, пожалуйста, скажите мне.
Вот мой MainTableCell.h:
import <UIKit/UIKit.h>
@interface MainTableCell : UITableViewCell {
UILabel *FormelNameLabel;
UILabel *ErklaerungVerfuegbarLabel;
UILabel *BeispielVerfuegbarLabel;
UILabel *RechnerVerfuegbarLabel;
}
@property (nonatomic, retain) IBOutlet UILabel *FormelNameLabel;
@property (nonatomic, retain) IBOutlet UILabel *ErklaerungVerfuegbarLabel;
@property (nonatomic, retain) IBOutlet UILabel *BeispielVerfuegbarLabel;
@property (nonatomic, retain) IBOutlet UILabel *RechnerVerfuegbarLabel;`
@end
А вот мой MainTableCell.m:
#import "MainTableCell.h"
@implementation MainTableCell
@synthesize FormelNameLabel;`
@synthesize ErklaerungVerfuegbarLabel;
@synthesize BeispielVerfuegbarLabel;
@synthesize RechnerVerfuegbarLabel;`
- (void)dealloc {
[FormelNameLabel release];
[ErklaerungVerfuegbarLabel release];
[BeispielVerfuegbarLabel release];
[RechnerVerfuegbarLabel release];
[super dealloc];
}
@end
Правильно ли вы подключили источник данных и делегат таблицыView? Если да, поместите контрольную точку в - (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) и посмотрите на возвращаемое значение (это должно быть количество ваших строк) – Stas
Таблица работает, но если я добавлю я не получаю подпись на табличных ячейках. Должен ли я объявить cellin rootviecontroller.h или где-то еще? Поскольку я только импортировал MainTableCell.h и ничего не сделал ... – Daniel05