Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.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
Ios 自定义uitableview崩溃报告NSuitableviewcellAccessbilityElement superview]无法识别的实例选择器_Ios_Tableviewcell - Fatal编程技术网

Ios 自定义uitableview崩溃报告NSuitableviewcellAccessbilityElement superview]无法识别的实例选择器

Ios 自定义uitableview崩溃报告NSuitableviewcellAccessbilityElement superview]无法识别的实例选择器,ios,tableviewcell,Ios,Tableviewcell,我创建了一个uitableview单元格来显示注释,这个单元格包含一个新的tableview来显示子命令。正常情况下,它工作正常,但有时会突然崩溃,向实例报告[NSUITableViewCellAccessibilityElement superview]无法识别的选择器。我花了很多时间,但无法修复它。我甚至不知道这场车祸什么时候会发生。有人能回答我的问题吗,谢谢 #import "HMCommentCell.h" #import "HMHttpUtil.h" #import "HMCommon

我创建了一个uitableview单元格来显示注释,这个单元格包含一个新的tableview来显示子命令。正常情况下,它工作正常,但有时会突然崩溃,向实例报告[NSUITableViewCellAccessibilityElement superview]无法识别的选择器。我花了很多时间,但无法修复它。我甚至不知道这场车祸什么时候会发生。有人能回答我的问题吗,谢谢

#import "HMCommentCell.h"
#import "HMHttpUtil.h"
#import "HMCommonUtil.h"
#import "HMSubcommentCell.h"
static NSString *cellForSubcomment = @"cellForSubcomment";
static NSString *subcommentCellnib = @"HMSubcommentCell";

@interface HMCommentCell ()<UITableViewDataSource, UITableViewDelegate,     HMSubcommentCellDelegate>


@end
@implementation HMCommentCell

- (void)awakeFromNib {
    // Initialization code
    [self setSelectionStyle:UITableViewCellSelectionStyleNone];
    [HMCommonUtil setupTitleTextView:_titleTextView];
    [HMCommonUtil setupTextView:_contentTextView];

    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, 1)];
        headerView.backgroundColor = [UIColor colorWithRed:51.0/255.0 green:51.0/255.0 blue:51.0/255.0 alpha:100.0/100.0];

        [_subCommentsView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
        _subCommentsView.scrollEnabled = NO;
        _subCommentsView.delegate = self;
        _subCommentsView.dataSource = self;
        _subCommentsView.tableHeaderView = headerView;
        _subCommentsView.tableFooterView = nil;

        [_subCommentsView registerNib:[UINib nibWithNibName:subcommentCellnib bundle:nil] forCellReuseIdentifier:cellForSubcomment];


    }

    - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
        [super setSelected:selected animated:animated];

        // Configure the view for the selected state
    }

    - (void)setSingleComment:(HMCommentEntity *)singleComment{
        _singleComment = singleComment;
        //[_subCommentsView reloadData];
    }

    - (void)SetupWithCommentEntity:(HMCommentEntity *)commentEntity{
        _userAvatarImageView.image = [UIImage imageNamed:@"MembersIcon"];
        if(commentEntity.creator.is_post_creator){
            _userAvatarImageView.backgroundColor = [UIColor colorWithRed:254.0/255.0 green:177.0/255.0 blue:45.0/255.0 alpha:100.0/100.0];
            [_authorLable setHidden:NO];
        }else{
            _userAvatarImageView.backgroundColor = [UIColor clearColor];
            [_authorLable setHidden:YES];
        }
        [HMHttpUtil asyncLoadImage:commentEntity.creator.avatar
                           success:^(UIImage *image) {
                               _userAvatarImageView.image = image;
                           } fail:^(NSError *error) {
                               NSLog(@"读取用户头像失败 %@", [error description]);

                           }];
        [HMHttpUtil asyncLoadImage:commentEntity.image_info.image_url
                           success:^(UIImage *image) {
                               _slideImageView.image = image;
                           } fail:^(NSError *error) {
                               NSLog(@"读取评论图片失败 %@", [error description]);
                           }];
        //NSLog(@"the reply_to_id of this comment is %@", commentEntity.reply_to_id);
        _titleTextView.text = commentEntity.commentCellTitle;
        _contentTextView.text = commentEntity.content;
        _timeLable.text = commentEntity.time;
        _singleComment = commentEntity;
        if([_singleComment.children count] == 0){
            _subCommentsView.hidden = YES;
        }else{
            _subCommentsView.hidden = NO;
            [self AdjustHeightOfContent:commentEntity];
            [self AdjustHeightOfSubcomments:commentEntity];
        }
        //[_replyButton setTitle:@"Reply" forState:UIControlStateNormal];

        [_subCommentsView reloadData];

    }

    #pragma mark - tableview datasource
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
        return 1;
    }

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
        return [_singleComment.children count] > 0? [_singleComment.children count]:0;
    }

    - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
        HMSubcommentCell *cell = [tableView dequeueReusableCellWithIdentifier:cellForSubcomment];
        cell.commentEntity = [_singleComment.children objectAtIndex:indexPath.row];
        cell.delegate = self;
        return cell;
    }

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
        return ((HMCommentEntity*)[_singleComment.children objectAtIndex:indexPath.row]).contentHeight;
    }


    #pragma mark - adjust the cell layout
    - (void)AdjustHeightOfContent:(HMCommentEntity*)commentEntity{
        CGRect contentFrame = _contentTextView.frame;
        contentFrame.size.height = commentEntity.contentHeight;
        [_contentTextView setFrame:contentFrame];
    }

    - (void)AdjustHeightOfSubcomments:(HMCommentEntity*)commentEntity{
        if(commentEntity.subCommentHeight > 0){
            CGRect subtableFrame = _subCommentsView.frame;
            float gap = commentEntity.subCommentHeight - subtableFrame.size.height;
            subtableFrame.size.height = commentEntity.subCommentHeight;
            subtableFrame.origin.y = subtableFrame.origin.y - gap;
            [_subCommentsView setFrame:subtableFrame];
        }
    }

    #pragma mark - reply function
    - (IBAction)ReplyFromCell:(id)sender {
        //[_delegate onReplyWithCommentEntity:_singleComment replyid:_singleComment.reply_to_id mark:_singleComment.mark];
        [self ArouseReplyFunction:_singleComment];
        //    NSLog(@"Reply button reacts");
    }

    - (IBAction)IntoCommenterInfo:(id)sender {
    }

    - (IBAction)IntoBigImage:(id)sender {
        if(_bigImageBoard){
            [_bigImageBoard ShowBigImageUsingANewVC:_singleComment.image_info.image_big_url];
        }
    }

    - (void)SubcommentCellOnReplyWithCommentEntity:(HMCommentEntity *)commentEntity{
        [self ArouseReplyFunction:commentEntity];
    }

    - (void)ArouseReplyFunction:(HMCommentEntity*)commentEntity{
        if(_delegate != nil){
            [_delegate CommentCellOnReplyWithCommentEntity:commentEntity commentIndex:_indexrow];
        }else{
            NSLog(@"commentcell delegate 为空");
        }
    }
    @end

我不知道这里发生了什么。但我很确定问题是由单元格中的tableview引起的。我不知道是否会有人发现这个问题。我不得不说,在可滚动控制器中嵌入可滚动控制器是危险的。我采用了一种正常的方式。

您能提供您的代码吗?显示调用superview的代码-即异常所在的行thrown@Paulw11我从不在代码中调用superview,异常是从内存之类的地方抛出的。真奇怪