为什么我的桌面视图没有被填充?

时间:2014-11-30 09:55:53

标签: ios objective-c xcode

我正在编写一个iPhone应用程序,但我的故事板中的一个表格视图并没有填充单元格。 这是实施。

#import "ManagerSettingsViewController.h"

@interface ManagerSettingsViewController ()
@property (strong, nonatomic) IBOutlet UILabel *numberOfSkillsLabel;
@property (strong, nonatomic) IBOutlet UISlider *sliderValue;

@end

@implementation ManagerSettingsViewController
@synthesize group;
@synthesize numberOfSkillsLabel;
@synthesize sliderValue;

- (void)viewDidLoad {
    [super viewDidLoad];
     NSLog(@"Skill list count: %lu", (unsigned long)[group.skillList count]);
    for(int i = 0; i < [group.skillList count]; i++){
        NSLog(@"%@", [group.skillList objectAtIndex:i]);
    }
    int temp = (int)sliderValue.value;
    NSString *sliderVal = [NSString stringWithFormat:@"%d", temp];
    [numberOfSkillsLabel setText:[sliderVal copy]];

    // Do any additional setup after loading the view.
}
- (IBAction)backButtonListener:(id)sender {

    [[self presentingViewController] dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)numberOfSkillsSlideListener:(id)sender {
     int temp = (int)sliderValue.value;
     NSString *sliderVal = [NSString stringWithFormat:@"%d", temp];
    [numberOfSkillsLabel setText:[sliderVal copy]];
    // sliderValue.value = temp;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
     NSLog(@"Skill list count: %lu", (unsigned long)[group.skillList count]);
     return [[group getSkillList] count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:   (NSIndexPath*)indexPath
{
    static NSString *simpleTableIdentifier = @"SimpleTableCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
    }

    cell.textLabel.text = [group.skillList objectAtIndex:indexPath.row];
    return cell;
}





/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before    navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end

这是头文件。

#import <UIKit/UIKit.h>
#import "Group.h"

@interface ManagerSettingsViewController : UIViewController <UITableViewDelegate,    UITableViewDataSource>

@property Group* group;
@end

对我来说,看起来没有调用正在创建单元格的方法,但是正在调用返回单元格数量的方法。表视图已绑定。

如果您需要其他代码段,请告诉我。

1 个答案:

答案 0 :(得分:-1)

它没有为Yours tableView设置委托和dataSource。