2012-03-18 3 views
0

FirstLevelController実装ファイルに対して次のコードを記述しましたが、Disclosure Buttonsアイコンはビューに表示されません。コードをチェックしましたが、何が間違っているか把握できません。Disclosureボタン、アイコンがFirstLevelControllerに表示されない

FirstLevelController.m:

#import "BiDFirstLevelController.h" 
#import "BidSecondLevelController.h" 
#import "BiDDisclosureButtonController.h" 



@implementation BiDFirstLevelController 
@synthesize controllers; 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    self.title = @"First Level"; 
    NSMutableArray *array = [[NSMutableArray alloc]init]; 


    // Disclosure button 
    BiDDisclosureButtonController *disclosureButtonController = [[BiDDisclosureButtonController alloc]initWithStyle:UITableViewStylePlain]; 
    disclosureButtonController.title = @"Disclosure Buttons"; 
    disclosureButtonController.rowImage = [UIImage imageNamed:@"disclosureButtonControllerIcon.png"]; 
    [array addObject:disclosureButtonController]; 
} 

- (id)initWithStyle:(UITableViewStyle)style 
{ 
    self = [super initWithStyle:style]; 
    if (self) { 
     // Custom initialization 
    } 
    return self; 
} 


- (void)viewDidUnload 
{ 
    [super viewDidUnload]; 
    self.controllers = nil; 
} 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
} 

#pragma mark - Table view data source 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{ 

    // Return the number of sections. 
    return 0; 
} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 

    // Return the number of rows in the section. 
    return [self.controllers count]; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *FirstLevelCell = @"FirstLevelCell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:FirstLevelCell]; 
    if (cell == nil) { 
     cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:FirstLevelCell]; 
    } 

    // Configure the cell... 
    NSUInteger row = [indexPath row]; 
    BiDSecondLevelController *controller = [controllers objectAtIndex:row]; 
    cell.textLabel.text = controller.title; 
    cell.imageView.image = controller.rowImage; 
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 
    return cell; 
} 

#pragma mark - Table view delegate 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    NSUInteger row = [indexPath row]; 
    BiDSecondLevelController *nextController = [self.controllers objectAtIndex:row]; 
    [self.navigationController pushViewController:nextController animated:YES]; 
} 

@end 
+0

あなたはBiDDisclosureButtonController内のrowImageプロパティを保持していますか何らかの形で所有していますか? – CodaFi

+0

rowImageプロパティは、BiDDisclosureButtonControllerのスーパークラスであるBiDSecondLevelControllerで宣言され、合成されます。 – pdenlinger

+0

は合成されていても、オブジェクトを所有するのに遠く離れていません。 – CodaFi

答えて

0

テーブルビューは常に空でなければなりません意味numberOfSectionsInTableView: 0を返し、あなたの実装。このメソッドから0を返すことは意味をなさないので、それはタイプミスだと思います。

+0

「return [self.controllers count];」に変更されました同じ問題が続く。 – pdenlinger

関連する問題