简体   繁体   中英

How To Properly Set Constraints To Multiple Buttons With Same Size To Prevent “Cannot find an outgoing row head for incoming head”

The layout you can see below is a UIViewController having four buttons with same size aligned horizontally and a UIPageViewController below them. The UIPageViewController holds 4 pages. Each page contains a UITableView .

在此输入图像描述

The four buttons is embedded in a UIView in which the constraints I set is:

  • leading to super view
  • top to TopLayoutGuide.bottom
  • trailing to super view
  • aspect ratio (height equal to width 5:32)

The constraints of the buttons inside are like:

  • every button has constraint to top and bottom space to super view
  • first and last has constraint to leading and trailing of super view
  • every button's width is equal to the first

The problem is, sometimes when this view controller transitions to another view controller, the app will crash. The error would be "Cannot find an outgoing row head for incoming head". When I check the memory address of which control produced the crash, it was always the first button which has a title "Live Radio".

The problem would be solved if I set the height of the container view(view that embeds the four buttons) to a fixed value, not aspect ratio. However, I want the size of the tabs to expand with respect to the size of the screen. So, this won't be a good solution for me.

Is there any other way to make the four buttons expand proportionally with the screen without using aspect ratio?

Thanks!

-------- EDIT ---------

Regarding how I transition to another view controller, it's just plain

[self performSegueWithIdentifer:@"showArtistDetailsView"];

我通过交换“直播电台”按钮的宽高比约束的宽度和高度来解决这个问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM