首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >简单的UIContextMenuConfiguration导致无法同时满足约束

简单的UIContextMenuConfiguration导致无法同时满足约束
EN

Stack Overflow用户
提问于 2020-07-17 06:01:41
回答 1查看 63关注 0票数 0

我创建了一个简单的ContextMenu

代码语言:javascript
复制
override func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
        let configuration = UIContextMenuConfiguration(identifier: nil, previewProvider: nil){ action in
            let delete = UIAction(title: "Delete", image: UIImage(systemName: "trash.fill"), identifier: nil,discoverabilityTitle: nil, attributes: .destructive, handler: {action in
                self.deleteItem(index: indexPath.item)
            })
            
            return UIMenu(title: "", image: nil, identifier: nil, children: [delete])
        }
        
        return configuration
    }

它会在控制台中引起以下警告。

代码语言:javascript
复制
2020-07-16 22:58:16.227394+0200 RunPersonalRecord[8410:2186970] [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. 
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
"<NSAutoresizingMaskLayoutConstraint:0x280eec230 h=--& v=--& UIInterfaceActionGroupView:0x1658ca700.height == 0   (active)>",
"<NSLayoutConstraint:0x280ed7e80 groupView.actionsSequence....height >= 44   (active, names: groupView.actionsSequence...:0x158340200 )>",
"<NSLayoutConstraint:0x280ed4a00 UIInterfaceActionGroupView:0x1658ca700.top == _UIContentConstraintsLayoutGuide:0x157d4dae0''.top   (active)>",
"<NSLayoutConstraint:0x280ed4140 V:[_UIContentConstraintsLayoutGuide:0x157d4dae0'']-(0)-|   (active, names: '|':UIInterfaceActionGroupView:0x1658ca700 )>",
"<NSLayoutConstraint:0x280ed6710 groupView.actionsSequence....top == _UIContentConstraintsLayoutGuide:0x157d4dae0''.top   (active, names: groupView.actionsSequence...:0x158340200 )>",
"<NSLayoutConstraint:0x280ed6760 groupView.actionsSequence....bottom == _UIContentConstraintsLayoutGuide:0x157d4dae0''.bottom   (active, names: groupView.actionsSequence...:0x158340200 )>") Will attempt to recover by breaking constraint <NSLayoutConstraint:0x280ed7e80 groupView.actionsSequence....height >= 44   (active, names: groupView.actionsSequence...:0x158340200 )>

这可能是一个苹果的bug,或者有可能以某种方式修复?谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-07-19 02:39:45

根据苹果论坛的说法,这是一个系统错误。现在,我们应该忽略这些警告。对最终用户没有影响。https://developer.apple.com/forums/thread/654647?page=1#621883022

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62944138

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档