表视图无法同时满足约束

时间:2017-12-30 21:26:25

标签: ios uitableview layout

我在这做什么?我正在尝试构建一个Instagram克隆,并在我的家庭视图控制器中显示帖子应该显示的内容。我使用表视图进行导航,并且该表视图有2个具有不同标识符的单元格。单元格编号1它是一个标题,用于将users表中的数据添加到我的用户名标签和配置文件图像中。它的帖子数据如图像和标题,它的帖子数据和帖子数量为2。我使用firebase数据库。问题是我的布局不像我想要的那样显示它给出了这个错误:

2017-12-31 00:00:31.920010+0300 Instgram Clone[2165:463944] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x60000029af40 UIImageView:0x7fdc8765e940.height == 375   (active)>",
    "<NSLayoutConstraint:0x604000284ba0 UIButton:0x7fdc874433e0.height == 30   (active)>",
    "<NSLayoutConstraint:0x604000285460 V:|-(0)-[UIImageView:0x7fdc8765e940]   (active, names: '|':UITableViewCellContentView:0x7fdc8765e110 )>",
    "<NSLayoutConstraint:0x6040002854b0 V:[UIImageView:0x7fdc8765e940]-(7)-[UIStackView:0x7fdc87442fd0]   (active)>",
    "<NSLayoutConstraint:0x6040002855a0 V:[UIStackView:0x7fdc87442fd0]-(7)-[UIView:0x7fdc87441230]   (active)>",
    "<NSLayoutConstraint:0x604000285640 V:[UIView:0x7fdc87441230]-(7)-[UIButton:0x7fdc87441410'\U2665\Ufe0e 15 Likes']   (active)>",
    "<NSLayoutConstraint:0x604000285690 V:[UIButton:0x7fdc87441410'\U2665\Ufe0e 15 Likes']-(NSSpace(8))-[UILabel:0x7fdc87442870'What a. Great day']   (active)>",
    "<NSLayoutConstraint:0x6040002857d0 V:[UILabel:0x7fdc87442870'What a. Great day']-(NSSpace(8))-[UIButton:0x7fdc87442550'Be the first one share a ...']   (active)>",
    "<NSLayoutConstraint:0x6040002858c0 UITableViewCellContentView:0x7fdc8765e110.bottomMargin == UILabel:0x7fdc87442b50'2 Day ago'.bottom + 12   (active)>",
    "<NSLayoutConstraint:0x604000285910 V:[UIButton:0x7fdc87442550'Be the first one share a ...']-(NSSpace(8))-[UILabel:0x7fdc87442b50'2 Day ago']   (active)>",
    "<NSLayoutConstraint:0x60000029c9d0 'UISV-canvas-connection' UIStackView:0x7fdc87442fd0.top == _UILayoutSpacer:0x6000001c8160'UISV-alignment-spanner'.top   (active)>",
    "<NSLayoutConstraint:0x604000281bd0 'UISV-canvas-connection' UIStackView:0x7fdc87442fd0.centerY == UIButton:0x7fdc874433e0.centerY   (active)>",
    "<NSLayoutConstraint:0x60000029c840 'UISV-spanning-boundary' _UILayoutSpacer:0x6000001c8160'UISV-alignment-spanner'.top <= UIButton:0x7fdc874433e0.top   (active)>",
    "<NSLayoutConstraint:0x604000285cd0 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fdc8765e110.height == 58.5   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x604000284ba0 UIButton:0x7fdc874433e0.height == 30   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.

只是为了知识:

postcell =视图标题

imagecell =视野

header cell constraints

post cell constraints

Continue with post cell constraints

this image to my result layout when the running app

当我将内容视图修复为高时,

我的新错误消息:

2018-01-01 02:56:25.304650+0300 Instgram Clone[1217:35419] Month 13 is out of bounds
2018-01-01 02:56:25.312217+0300 Instgram Clone[1217:35419] Month 13 is out of bounds
2018-01-01 02:56:25.338368+0300 Instgram Clone[1217:35424] Month 13 is out of bounds
2018-01-01 02:56:25.343009+0300 Instgram Clone[1217:35431] Month 13 is out of bounds
2018-01-01 02:56:25.374175+0300 Instgram Clone[1217:35323] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600000483750 UIImageView:0x7fdf61548390.height == 36   (active)>",
    "<NSLayoutConstraint:0x600000483d90 V:[UIImageView:0x7fdf61548390]-(8.5)-|   (active, names: '|':UITableViewCellContentView:0x7fdf615481a0 )>",
    "<NSLayoutConstraint:0x600000483de0 V:|-(12)-[UIImageView:0x7fdf61548390]   (active, names: '|':UITableViewCellContentView:0x7fdf615481a0 )>",
    "<NSLayoutConstraint:0x604000482530 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fdf615481a0.height == 57   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000483750 UIImageView:0x7fdf61548390.height == 36   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.

0 个答案:

没有答案