私は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
データソースとtableViewの代理人を正しく接続しましたか?もしそうなら、 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)セクションに戻り、戻り値を調べてください。(行の数でなければなりません) – Stas
テーブルは動作しますが、セルは、テーブルセルに署名を取得しません。私はcellinをrootviecontroller.hまたは他のどこかで宣言しなければなりませんか? MainTableCell.hをインポートしただけなので、何もしなかったので... – Daniel05