Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.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
正确使用可重用的UITableViewCell_Uitableview - Fatal编程技术网

正确使用可重用的UITableViewCell

正确使用可重用的UITableViewCell,uitableview,Uitableview,我正在尝试构建一个应用程序,它使用可重用的UITableViewCells。在我的第一个UITableView中,一切正常,但现在,在我的第二个表中,我不能使用可重用的UITableViewCell,该单元格保持空白。以下是我的配置: 一,;我创建了一个UITableViewCell类 二,;我将UITableViewCell链接到我在第一步中创建的服装UITableViewClass 三,;我将“重用标识符”设置为Cell1 四,;我向可重用的UITableViewCell添加了一些内容 五,

我正在尝试构建一个应用程序,它使用可重用的UITableViewCells。在我的第一个UITableView中,一切正常,但现在,在我的第二个表中,我不能使用可重用的UITableViewCell,该单元格保持空白。以下是我的配置:

一,;我创建了一个UITableViewCell类

二,;我将UITableViewCell链接到我在第一步中创建的服装UITableViewClass

三,;我将“重用标识符”设置为
Cell1

四,;我向可重用的UITableViewCell添加了一些内容

五,;我将UITableViewCell类导入UIViewController

六,;我将标准UITableView代码添加到我的UIViewController中:
@property(弱,非原子)IBOutlet UITableView*tableview,

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

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *costumeCell1 = @"Cell1";

    AppDetailCell1 *cell1 = [tableView dequeueReusableCellWithIdentifier:costumeCell1];

    if (!cell1) {
        cell1 = [[AppDetailCell1 alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:costumeCell1];
    }

    cell1.appIconImageView.image = self.appIcon;
    cell1.detailAppNameTextView.text = self.detailAppName;
    cell1.developerLabel.text = [NSString stringWithFormat:@"By %@", self.appDeveloper];

    return cell1;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}
七,;我构建了这个项目,但我只能找到一个空白的UITableView

我使用的方法与在其他UIViewController中使用其他可重用TableViewCell的方法相同


有人知道我如何解决我的问题吗?

您的
UITableViewDataSource
方法实际被调用了吗?(NSLog)不,他们没有被调用,我再次检查了我的代码,发现我忘了将委托设置为self,愚蠢的我!!