iOS 11中后退按钮未正确对齐

时间:2017-10-13 05:30:24

标签: uibarbuttonitem ios11 navigationbar pushviewcontroller

我们开始使用Xcode 8.3处理我们的项目,直到iOS 10都很好但是当我们在iOS 11中运行相同的应用程序时,后退按钮没有按照预期对齐,如下图所示

iOS 11 screenshot

但是对于iOS 10,它已正确对齐

iOS 10 Screenshot

这就是我们得到的布局约束错误

(
"<NSLayoutConstraint:0x600000288200 _UIModernBarButton:0x7f7ef5c87f10.bottom == UILayoutGuide:0x6000005a0380'UIViewLayoutMarginsGuide'.bottom + 64.5   (active)>",
"<NSLayoutConstraint:0x600000287f30 V:[_UIModernBarButton:0x7f7ef5c87f10]-(>=0)-|   (active, names: '|':_UIButtonBarButton:0x7f7ef5c86e60 )>",
"<NSLayoutConstraint:0x600000282030 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x6000005a0380'UIViewLayoutMarginsGuide']-(16)-|   (active, names: '|':_UIButtonBarButton:0x7f7ef5c86e60 )>"

2 个答案:

答案 0 :(得分:7)

对我来说,这是因为我使用下面的一些技巧来隐藏标题

WindowsAzure.Storage

我们不应该这样做,它在iOS 11上不起作用,并会像您发布的那样触发大量的自动布局问题。因此,请检查后退按钮上是否有UIBarButtonItem.appearance().setBackButtonTitlePositionAdjustment(UIOffsetMake(0, -1000), for: .default)

如果您确实要隐藏后退按钮上的文字,则应该https://stackoverflow.com/a/46889050/1418457

答案 1 :(得分:1)

df2 <- df[sample(nrow(df)),]
df2 = df2[order(id, date)]
df2[, days_from_start := cumsum(c(0, diff(as.Date(date)))), by = .(id, cumsum(event))]

    id       date event days_from_start
 1:  A 2000-01-13     1               0
 2:  A 2000-01-18     0               5
 3:  A 2000-01-25     0              12
 4:  A 2000-01-31     0              18
 5:  B 2012-10-10     0               0
 6:  B 2012-10-11     0               1
 7:  B 2012-10-14     1               0
 8:  B 2012-10-15     0               1
 9:  C 2005-07-25     1               0
10:  C 2005-07-31     0               6