Warnings: Misplaced View

前端 未结 6 1707
耶瑟儿~
耶瑟儿~ 2021-01-30 20:41

I recently updated Xcode and I got the following warnings:

\"enter

I tried Editor

相关标签:
6条回答
  • 2021-01-30 20:52

    In Xcode 8.1 there is now a refresh button to the far left, click your views and click that to be the equivalent of the old update frames.

    0 讨论(0)
  • 2021-01-30 20:53

    To be more specific, Select your view, Go to Editor Menu -> from Resolve Auto Layout Issues select 'Clear Constraints'. This should clear your constraints and no longer give you warning when you move your components.

    0 讨论(0)
  • 2021-01-30 20:54

    In Xcode 5 the position of views on the canvas does not update when constraints are applied. Thus, it is possible to have constraints that specify a different position for the view than you see it in Interface Builder. You can correct this by pressing Command + Option + = or selecting "Update Frames" in the |-•-| menu (I think it looks like a tie fighter).

    Update for Xcode 8: The "Update Frames" command now has its own button. It's located just to the left of the Stack View / Alignment / Constraints buttons and looks like a reload arrow surrounded by corner brackets:

    0 讨论(0)
  • 2021-01-30 20:54

    Xcode 8: I got this warning with 1 UICollectionView in the Storyboard and no constraints at all. Switching the "View as"-Device at the bottom to any other device and back removes the warning.

    0 讨论(0)
  • 2021-01-30 20:55

    In XCode 6 the Warning is now accompanied with dimensions indicating where the view will be placed given the current constraints. If your constraints are correct (or you believe them to be) and the view (eg. a label) is not at that location, try changing the view's dimensions to the expected dimensions in the warning. If the view ends up in the right place and the warning goes away, it confirms that your constraints are working as expected.

    Simply removing the constraints may remove the warning but won't necessarily give you the Auto Layout behavior you are hoping for.

    0 讨论(0)
  • 2021-01-30 21:16

    Select this view in Storyboard, then 'Editor -> Resolve Auto-Layout Issues -> Update All Constraints in View'

    It works for me.

    0 讨论(0)
提交回复
热议问题