2012-02-14 3 views
1

나는 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입니다 : 당신이 줄

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

도 댓글을 달았습니다

#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 
+0

제대로 연결 했습니까? datasource 및 tableView 대리인을 연결 했습니까? 그렇다면 - (NSInteger) tableView : (UITableView *) tableView numberOfRowsInSection : (NSInteger) 섹션에 중단 점을 입력하고 반환 값을 확인하십시오. (행의 수량이어야합니다) – Stas

+0

표가 작동하지만 테이블을 추가하면 세포 내가 tablecells에 서명을 얻을 것이다. 나는 cellin을 rootviecontroller.h 또는 다른 곳에서 선언해야합니까? MainTableCell.h 만 가져 왔고 다른 작업은 수행하지 않았기 때문에 ... – Daniel05

답변

0

확인 wthr

selectedFormel.nameFormel 

에는 어떤 값이 들어 있습니다.

+0

selectedFormel.nameFormel은 문자열을 반환합니다. 그러나 나는 당신이 당신의 포스트의 첫번째 부분으로 의미하는 것을 모른다. ... – Daniel05

0

오케이, 나는 대답하려고 노력할 것이다. 1. label.text로 설정하기 전에 selectedFormel.nameFormel에이 값을 NSLog로 문의하십시오.

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

2. 셀을 올바르게 구성 했습니까? 예를 들어 FormelNameLabel의 프레임이 0이 아니라고 확신합니까?

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

레이블을 셀에 하위보기로 추가 했습니까? 이 모든 작업을 완료했지만 여전히 셀에서 코드를 제공하지 않는다고 표시됩니다!

+0

내위원회 : selectedFormel.nameFormel : PQ-Formel; cellFrame : {{0, 0}, {320, 44}} - 지금 은요? 내 MainTableCell.h/.m을 게시해야합니까? – Daniel05

+0

네, 게시해야한다고 생각합니다. – Stas

관련 문제