小编Die*_*rre的帖子

'常数不是有限的!那是违法的.目标C中的常数:nan'错误

当我尝试启动我正在处理的应用程序时,我收到以下错误.'常数不是有限的!那是违法的.恒:楠"

这是Instagram的学校项目克隆.我认为错误是在子视图中或可能在创建的约束中,但不幸的是我只是没有看到问题.

- (void) layoutSubviews {
    [super layoutSubviews];

     // Before layout, calculate the intrinsic size of the labels (the size they "want" to be), and add 20 to the height for some vertical padding.
    CGSize maxSize = CGSizeMake(CGRectGetWidth(self.bounds), CGFLOAT_MAX);
    CGSize usernameLabelSize = [self.usernameAndCaptionLabel sizeThatFits:maxSize];
    CGSize commentLabelSize = [self.commentLabel sizeThatFits:maxSize];

    self.usernameAndCaptionLabelHeightConstraint.constant = usernameLabelSize.height + 20;
    self.commentLabelHeightConstraint.constant = commentLabelSize.height + 20;
    self.imageHeightConstraint.constant = self.mediaItem.image.size.height / self.mediaItem.image.size.width * CGRectGetWidth(self.contentView.bounds);

    // Hide the line between cells
    self.separatorInset = UIEdgeInsetsMake(0, 0, 0, CGRectGetWidth(self.bounds));
}

NSDictionary …
Run Code Online (Sandbox Code Playgroud)

objective-c ios

7
推荐指数
1
解决办法
8926
查看次数

标签 统计

ios ×1

objective-c ×1