简体   繁体   English

原型CellView中的TableView不反应

[英]TableView in a Prototype CellView doesn't react

i have a problem... don't get why.. 我有一个问题...不知道为什么..

i have a storyboard with only one UIViewController which has a UITableView ( Outlet ). 我有一个只有一个具有UITableView(Outlet)的UIViewController的情节提要。 The UITableView has a Prototype Cell ( Outlet ) with his Custom Class. UITableView有一个带有其自定义类的原型单元格(Outlet)。 This Custom class/this Prototype Cell has a UITableView ( Outlet ) BUT this last tableView doesnt appear, doesnt react doesnt do anything ... don't get why, the links in the IB are OK... 这个自定义类/这个原型单元有一个UITableView(Outlet)但是最后一个tableView没有出现,没有反应没有做任何事情...不知道为什么,IB中的链接还可以...

here is my project : https://www.dropbox.com/sh/ouq6syndy489xgy/c5QbMsLDi7 这是我的项目: https : //www.dropbox.com/sh/ouq6syndy489xgy/c5QbMsLDi7

this is the code which control the UITableView which doesnt react : 这是控制不响应的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);
}

I just downloaded your project and checked. 我刚刚下载了您的项目并进行了检查。 I can not simply give an answer to your question. 我不能简单地回答你的问题。 You are doing it all wrong. 你做错了一切。 You have a tableview with a prototype cell, and inside this prototypecell you have added another tableview , which is not a cell. 您具有带原型单元格的表格视图,并且在此原型单元内添加了另一个tableview,它不是单元格。

If you need to customize your tableview's cells, follow this tutorial, 如果您需要自定义表格视图的单元格,请遵循本教程,

http://www.appcoda.com/customize-table-view-cells-for-uitableview/ http://www.appcoda.com/customize-table-view-cells-for-uitableview/

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM