Ios 视图控制器内的UITableView

Ios 视图控制器内的UITableView,ios,objective-c,xcode,sqlite,uitableview,Ios,Objective C,Xcode,Sqlite,Uitableview,这是我的视图控制器,如您所见,在下部有一个UITableView 我将委托和数据源放在.h文件中 @interface CourseFindrViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> 代码到此为止。我添加了一个断点 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { retu

这是我的视图控制器,如您所见,在下部有一个UITableView

我将委托和数据源放在.h文件中

@interface CourseFindrViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
代码到此为止。我添加了一个断点

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [self.course count];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"courseCell"];
    NSLog(@"Here.");
    Course *courses = [self.course objectAtIndex:indexPath.row];
    cell.textLabel.text =courses.cName;
    cell.detailTextLabel.text =courses.cSchool;
    return cell;
}
它仍然没有将数据传递到表中。。桌子没有出现。

您必须在表视图与数据源和委托之间添加连接。
要执行此简单的控件,请从表视图拖动到视图控制器,然后选择datasource并执行相同的操作,但这次选择delegate。

您必须在xib中连接datasource和delegate。请告诉我这个答案是否对您有帮助。

您是否设置了tableView委托和数据源。?您是否从xib或以编程方式连接了数据源和委托?@santhu您是什么意思?@LucaIaco是的。这是我见过的最不具描述性的问题标题。这是如何对手头的问题进行远程总结的呢?你能把log:NSLog(@“Array count:%d”,[self.course count]);在tableView:numberOfRowsInSection:method中,让我知道它被调用了吗?是您的日志NSLog(@“这里”);调用
NSLog(@“Here”)未被调用,因为它无法通过断点。数组计数为0..:(如何修复?:/您有表视图的出口吗?如果没有,请创建一个出口并调用[tableView reloadData];在viewDidLoad方法的末尾。我发现了问题。应该是
==SQLITE OK
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [self.course count];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"courseCell"];
    NSLog(@"Here.");
    Course *courses = [self.course objectAtIndex:indexPath.row];
    cell.textLabel.text =courses.cName;
    cell.detailTextLabel.text =courses.cSchool;
    return cell;
}