我有问题。。不明白为什么。。
我有一个只有一个 UIViewController 的故事板,它有一个 UITableView ( Outlet )。UITableView 有一个原型单元( Outlet )和他的自定义类。这个自定义类/这个原型单元有一个 UITableView ( Outlet ) 但是最后一个 tableView 没有出现,没有反应没有做任何事情......不明白为什么,IB中的链接是好的......
这是我的项目: https ://www.dropbox.com/sh/ouq6syndy489xgy/c5QbMsLDi7
这是控制没有反应的 UITableView 的代码:
#import "Cell.h"
@implementation Cell
@synthesize tableViewForCell;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self.contentView.layer setBorderColor:[UIColor grayColor].CGColor];
[self.contentView.layer setBorderWidth:1.0f];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"hours"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"hours"];
}
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 30;
//return CGSizeMake(rect.size.width/X, rect.size.height/5);
}