UITableViewCell не отображается в моей таблице - PullRequest
1 голос
/ 14 февраля 2012

У меня есть UITableVIew. Теперь я сделал свой собственный UITableViewCell. Но если моя таблица появляется, ничего не отображается. Однако ячейки по-прежнему можно выбрать и открыть DetailView. Какую команду я забыл?

//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

Ответы [ 2 ]

0 голосов
/ 14 февраля 2012

хорошо, я постараюсь ответить. 1. попробуйте NSL. Установите значение selectedFormel.nameFormel перед его установкой в ​​label.text.

NSLog(@"selectedFormel.nameFormel:%@", selectedFormel.nameFormel);

2.Вы правильно настроили свою ячейку? Вы уверены, что, например, кадр FormelNameLabel не равен нулю?

NSLog(@"cellFrame:%@", NSStringFromCGRect(cell.frame));

Вы уверены, что добавили метку в ячейку в качестве подпредставления? Если все это сделано, но ничего не показывает, предоставьте код из своей ячейки!

0 голосов
/ 14 февраля 2012

вы прокомментировали эту строку

cell. VerwaltungInformation *selectedFormel = [listOfFormularies objectAtIndex:indexPath.row];

, а также проверили, что wthr

selectedFormel.nameFormel 

содержит любое значение.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...