小编Lkm*_*Lkm的帖子

控制可能到达非空函数

附加的代码返回错误:

Control may reach end non-void function
Run Code Online (Sandbox Code Playgroud)

代码:

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

    if (indexPath.row == 0) {
        FirstCustomCell *fCustomCell = [tableView dequeueReusableCellWithIdentifier:@"firstCustomCell" forIndexPath:indexPath];

        if (fCustomCell == nil) {

            fCustomCell = [[FirstCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"firstCustomCell"];
        }

        return fCustomCell;

    }

    else if (indexPath.row == 1) {
        SecondCustomCell *sCustomCell = [tableView dequeueReusableCellWithIdentifier:@"secondCustomCell" forIndexPath:indexPath];

        if (sCustomCell == nil) {

            sCustomCell = [[SecondCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SecondCustomCell"];
        }

        return sCustomCell;

    }
} //<-- Control may reach non-void function (I precise that's the end …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview ios

0
推荐指数
1
解决办法
354
查看次数

标签 统计

ios ×1

objective-c ×1

uitableview ×1