TableView的cellForRowAtIndexPath不执行
TableView的cellForRowAtIndexPath不执行,不过NumberofRow这个函数返回的值是正确的,包括NumberofSections的值也没问题。
我用的是Storyboard, 自己定义的TableView,
能执行到 NumberofRow, 就是不执行cellForRow!
在xcode4中 xib下是没问题的
我在xcode5中用了Storyboard, 代码是一样的, 包括定义的也都是一样的, 结果不显示! 是不是有什么绑定我没做到?
ViewController.h:
@interface ViewController : UIViewController
<UITableViewDataSource, UITableViewDelegate>
@property (copy, nonatomic) NSMutableArray *prjlist;
@property (nonatomic, strong) UITableView *mytable;
.m
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.prjlist count];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
NSLog(@"%i", self.prjlist.count); //能执行到,值正确
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//不执行
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = (UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
NSMutableDictionary *prjinfo = self.prjlist[indexPath.row];
cell.textLabel.text = [prjinfo objectForKey:@"prj_name"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}