Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 为什么我的表视图没有被填充?_Ios_Objective C_Xcode - Fatal编程技术网

Ios 为什么我的表视图没有被填充?

Ios 为什么我的表视图没有被填充?,ios,objective-c,xcode,Ios,Objective C,Xcode,我正在编写一个iPhone应用程序,但我故事板中的一个表格视图没有填充单元格。 下面是实现 #import "ManagerSettingsViewController.h" @interface ManagerSettingsViewController () @property (strong, nonatomic) IBOutlet UILabel *numberOfSkillsLabel; @property (strong, nonatomic) IBOutlet UISlider

我正在编写一个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
#导入“ManagerSettingsViewController.h”
@接口管理器设置IEWController()
@属性(强,非原子)IBUILabel*numberOfSkillsLabel;
@属性(强,非原子)IBUISlider*sliderValue;
@结束
@实施管理器设置IEWController
@合成基团;
@合成多个skillslabel;
@综合滑动值;
-(无效)viewDidLoad{
[超级视图下载];
NSLog(@“技能列表计数:%lu”,(无符号长)[group.skillList计数]);
对于(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设置文本:[幻灯片副本]];
//加载视图后执行任何其他设置。
}
-(iAction)backButtonListener:(id)发送方{
[[self-presentingViewController]解除ViewController激活:是完成:无];
}
-(iAction)numberOfSkillsSlideListener:(id)发送方{
int temp=(int)sliderValue.value;
NSString*sliderVal=[NSString stringWithFormat:@“%d”,temp];
[numberOfSkillsLabel设置文本:[幻灯片副本]];
//sliderValue.value=温度;
}
-(无效)未收到记忆警告{
[超级记忆警告];
//处置所有可以重新创建的资源。
}
-(NSInteger)表视图:(UITableView*)表视图行数节:(NSInteger)节
{
NSLog(@“技能列表计数:%lu”,(无符号长)[group.skillList计数]);
返回[[group getSkillList]计数];
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
静态NSString*simpleTableIdentifier=@“SimpleTableCell”;
UITableViewCell*单元格=[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
如果(单元格==nil){
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault重用标识符:simpleTableIdentifier];
}
cell.textlab.text=[group.skillList objectAtIndex:indexath.row];
返回单元;
}
/*
#pragma标记-导航
//在基于故事板的应用程序中,您通常需要在导航之前做一些准备
-(void)prepareForSegue:(UIStoryboardSegue*)segue发送方:(id)发送方{
//使用[segue destinationViewController]获取新的视图控制器。
//将选定对象传递给新的视图控制器。
}
*/
@结束
这是头文件

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

@interface ManagerSettingsViewController : UIViewController <UITableViewDelegate,    UITableViewDataSource>

@property Group* group;
@end
#导入
#导入“Group.h”
@接口管理器设置ViewController:UIViewController
@地产集团*集团;
@结束
在我看来,创建单元格的方法似乎没有被调用,但返回单元格计数的方法正在被调用。表视图已绑定


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

您没有为tableView设置委托和数据源。

是。如果查看viewDidLoad方法,它会将应该进入单元格的文本值打印到控制台中。他们打印出正确的值,所以我知道group属性不是nil。你说如果你在
cellforrowatinexpath
中设置断点,它不会被触发?尽管在
numberOfRowsInSection
中返回了一个>0的值,是的。我刚刚试过,断点没有被触发。你还没有在Interface Builder中绑定数据源,是吗?它们被绑定了。