I am trying to figure out a constraint issue when presenting my UIAlertController.
2019-04-26 11:40:42.140007+0100 MyAPP[12811:3974220] [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.
(
""
)
Will attempt to recover by breaking constraint
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful.
I create and present the UIAlertController using the following function
#discardableResult
static func showOptionsModal(withOptions options:[String], sender:UIViewController ,holderView:UIView, arrowPosition:UIPopoverArrowDirection, completion: ((_ option:Int) -> ())?)->UIAlertController {
let moreActionsCellSheetController = UIAlertController(title:nil, message: nil,preferredStyle: .actionSheet)
for (i, option) in options.enumerated(){
let optionAction = UIAlertAction(title:option, style: .default){ (_) in
completion?(i)
}
moreActionsCellSheetController.addAction(optionAction)
}
if UIDevice.current.userInterfaceIdiom != .pad {
let actionCancel = UIAlertAction(title:printLocalized(withKey: "messages.cancel", targetSpecific: false), style: .destructive){ (_) in
completion?(-1)
}
moreActionsCellSheetController.addAction(actionCancel)
}
moreActionsCellSheetController.view.tintColor = UIColor.black
moreActionsCellSheetController.popoverPresentationController?.sourceView = holderView
moreActionsCellSheetController.popoverPresentationController?.sourceRect = holderView.frame
switch arrowPosition {
case .up:
moreActionsCellSheetController.popoverPresentationController?.sourceRect.origin.y = 0
moreActionsCellSheetController.popoverPresentationController?.sourceRect.origin.x = (-holderView.frame.width / 8)
moreActionsCellSheetController.popoverPresentationController?.permittedArrowDirections = .up
case .right:
moreActionsCellSheetController.popoverPresentationController?.sourceRect.origin.y = 0
moreActionsCellSheetController.popoverPresentationController?.sourceRect.origin.x = 0
moreActionsCellSheetController.popoverPresentationController?.permittedArrowDirections = .right
case .down:
moreActionsCellSheetController.popoverPresentationController?.sourceRect.origin.y = holderView.bounds.width/2
moreActionsCellSheetController.popoverPresentationController?.permittedArrowDirections = .down
case .left:
moreActionsCellSheetController.popoverPresentationController?.sourceRect.origin.y = holderView.bounds.height/2
moreActionsCellSheetController.popoverPresentationController?.permittedArrowDirections = .left
default:
moreActionsCellSheetController.popoverPresentationController?.sourceRect.origin.y = 0
moreActionsCellSheetController.popoverPresentationController?.sourceRect.origin.x = 0
moreActionsCellSheetController.popoverPresentationController?.permittedArrowDirections = .any
}
sender.present(moreActionsCellSheetController,animated: true, completion: nil)
return moreActionsCellSheetController
}
I am added a symbolic breakpoint and added an action like so:
The autolayoutTrace shows the following result:
•UIWindow:0x159d197b0 - AMBIGUOUS LAYOUT
| •UIView:0x159d3fbf0
| | *<UILayoutGuide: 0x2817eda40 - "UIViewSafeAreaLayoutGuide", layoutFrame = {{0, 44}, {375, 734}}, owningView = <UIView: 0x159d3fbf0; frame = (0 0; 375 812); autoresize = W+H; tintColor = UIExtendedSRGBColorSpace 0.176471 0.176471 0.176471 1; layer = <CALayer: 0x282ec41a0>>>
| | *UIView:0x159d367d0
| | | UILayoutContainerView:0x159d580b0
| | | | UINavigationTransitionView:0x159d5a760
| | | | | UIViewControllerWrapperView:0x159d4e880
| | | | | | •UIView:0x15b403b70
| | | | | | | *<UILayoutGuide: 0x2817fd5e0 - "UIViewSafeAreaLayoutGuide", layoutFrame = {{0, 0}, {375, 640}}, owningView = <UIView: 0x15b403b70; frame = (0 44; 375 640); autoresize = W+H; tintColor = UIExtendedSRGBColorSpace 0.176471 0.176471 0.176471 1; layer = <CALayer: 0x282e8ad20>>>
| | | | | | | *DAT_Air_Vinyl.MainLabel:0x15b503030'Select device to connect ...'
| | | | | | | *UIScrollView:0x15c014c00
| | | | | | | | *<_UIScrollViewContentOffsetGuide: 0x2817ecfc0 - "UIScrollView-contentOffsetLayoutGuide", layoutFrame = {{0, 0}, {0, 0}}, owningView = <UIScrollView: 0x15c014c00; frame = (0 0; 375 640); clipsToBounds = YES; hidden = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x282079e00>; layer = <CALayer: 0x282e8ce00>; contentOffset: {0, 0}; contentSize: {375, 746}; adjustedContentInset: {0, 0, 0, 0}>>
| | | | | | | | *DAT_Air_Vinyl.RecordHeaderView:0x15b503320
| | | | | | | | | *DAT_Air_Vinyl.RecordHeaderView:0x15b406010
| | | | | | | | | | *<UILayoutGuide: 0x2817e5a40 - "UIViewSafeAreaLayoutGuide", layoutFrame = {{0, 0}, {375, 150}}, owningView = <DAT_Air_Vinyl.RecordHeaderView: 0x15b406010; frame = (0 0; 375 150); clipsToBounds = YES; autoresize = RM+BM; layer = <CALayer: 0x282e8b120>>>
| | | | | | | | | | *UIView:0x15b406240
| | | | | | | | | | | *DAT_Air_Vinyl.MainButton:0x15b406420'Enable'
| | | | | | | | | | | | UIImageView:0x159d74e80
| | | | | | | | | | | | UIButtonLabel:0x15b406950'Enable'
| | | | | | | | | | | *DAT_Air_Vinyl.MainView:0x15b4070b0
| | | | | | | | | | | | *DAT_Air_Vinyl.MainLabel:0x15b4075f0'Gain:'
| | | | | | | | | | | | *DAT_Air_Vinyl.SelectorDropDownView:0x15b407ae0
| | | | | | | | | | | | | *UIImageView:0x15b604f90
| | | | | | | | | | | | | *DAT_Air_Vinyl.MainLabel:0x15b60aa20'0 dB'
| | | | | | | | | | | *DAT_Air_Vinyl.MainButton:0x15b4041a0'Clear all'
| | | | | | | | | | | | UIImageView:0x159d79740
| | | | | | | | | | | | UIButtonLabel:0x15b4046d0'Clear all'
| | | | | | | | | | *UIView:0x15b508ed0
| | | | | | | | | *UIView:0x15b50d250
| | | | | | | | *DAT_Air_Vinyl.MainTableView:0x15c025c00
| | | | | | | | | UIView:0x15b5084d0
| | | | | | | | | UIImageView:0x159d767c0
| | | | | | | | | UIImageView:0x159d769f0
| | | | | | | | UIImageView:0x159d76f70
| | | | | | | | UIImageView:0x159d76d40
| | | | | | | *_TtCC13DAT_Air_Vinyl20SelectorDropDownView12DropDownView:0x15b509420
| | | | | | | | *DAT_Air_Vinyl.MainTableView:0x15c026800
| | | | | | | | | UIView:0x15b50a210
| | | | | | | | | UIImageView:0x159d7a740
| | | | UINavigationBar:0x159d582b0
| | | | | _UIBarBackground:0x159d58770
| | | | | | UIImageView:0x159d58c00
| | | | | _UINavigationBarLargeTitleView:0x159d59880
| | | | | | UILabel:0x159d59dc0
| | | | | •_UINavigationBarContentView:0x159d59260
| | | | | | *<UILayoutGuide: 0x2817ee060 - "BackButtonGuide(0x159d59720)", layoutFrame = {{0, 0}, {8, 44}}, owningView = <_UINavigationBarContentView: 0x159d59260; frame = (0 0; 375 44); layer = <CALayer: 0x282eaea60>>>
| | | | | | *<UILayoutGuide: 0x2817ee140 - "LeadingBarGuide(0x159d59720)", layoutFrame = {{8, 0}, {0, 44}}, owningView = <_UINavigationBarContentView: 0x159d59260; frame = (0 0; 375 44); layer = <CALayer: 0x282eaea60>>>
| | | | | | *<UILayoutGuide: 0x2817ee220 - "TitleView(0x159d59720)", layoutFrame = {{8, 0}, {359, 44}}, owningView = <_UINavigationBarContentView: 0x159d59260; frame = (0 0; 375 44); layer = <CALayer: 0x282eaea60>>>
| | | | | | *<UILayoutGuide: 0x2817ee300 - "TrailingBarGuide(0x159d59720)", layoutFrame = {{367, 0}, {0, 44}}, owningView = <_UINavigationBarContentView: 0x159d59260; frame = (0 0; 375 44); layer = <CALayer: 0x282eaea60>>>
| | | | | | *<UILayoutGuide: 0x2817ee3e0 - "UIViewLayoutMarginsGuide", layoutFrame = {{16, 0}, {343, 44}}, owningView = <_UINavigationBarContentView: 0x159d59260; frame = (0 0; 375 44); layer = <CALayer: 0x282eaea60>>>
| | | | | | *<UILayoutGuide: 0x2817e5ce0 - "UIViewSafeAreaLayoutGuide", layoutFrame = {{0, 0}, {375, 44}}, owningView = <_UINavigationBarContentView: 0x159d59260; frame = (0 0; 375 44); layer = <CALayer: 0x282eaea60>>>
| | | | | | *_UITAMICAdaptorView:0x15b50e7a0
| | | | | | | DAT_Air_Vinyl.RecordViewNavigationBar:0x15b504370
| | | | | | | | UIImageView:0x15b50d430
| | | | | | | | DAT_Air_Vinyl.ScrollableTextView:0x15b50d660
| | | | | | | | | UIScrollView:0x15c017200
| | | | | | | | | | DAT_Air_Vinyl.MainLabel:0x15b50d8c0'DAT-Air WSS (95B6DC)'
| | | | | | | | | | DAT_Air_Vinyl.MainLabel:0x15b50dbb0'DAT-Air WSS (95B6DC)'
| | | | | | | | UIButton:0x15b50dea0
| | | | | | | | | UIImageView:0x159d773f0
| | | | | _UINavigationBarModernPromptView:0x159d5a0b0
| | *UIView:0x159d369b0
| | | *DAT_Air_Vinyl.MiniPlayerView:0x159d458c0
| | | | *<UILayoutGuide: 0x2817edb20 - "UIViewSafeAreaLayoutGuide", layoutFrame = {{0, 0}, {375, 1}}, owningView = <DAT_Air_Vinyl.MiniPlayerView: 0x159d458c0; frame = (0 0; 375 1); autoresize = W+H; gestureRecognizers = <NSArray: 0x2820829a0>; layer = <CALayer: 0x282eda960>>>
| | | | *UIImageView:0x159e0ec60
| | | | *DAT_Air_Vinyl.ScrollableTextView:0x159e10b20
| | | | | UIScrollView:0x15a828200
| | | | | | DAT_Air_Vinyl.MainLabel:0x159e10f80
| | | | | | DAT_Air_Vinyl.MainLabel:0x159d482b0
| | | | *UIButton:0x159d44cf0
| | | | | UIImageView:0x159d3ea10
| | | | *UIView:0x159d489a0
| | | | *UIView:0x159d48b80
| | *UITabBar:0x159d36b90
| | | _UIBarBackground:0x159d3ec60
| | | | UIImageView:0x159d3f390
| | | | UIVisualEffectView:0x159d3f5c0
| | | | | _UIVisualEffectBackdropView:0x159d47010
| | | | | _UIVisualEffectSubview:0x159d3c420
| | | | | _UIVisualEffectSubview:0x159d3da80
| | | UITabBarButton:0x159d404b0
| | | | UITabBarSwappableImageView:0x159d33330
| | | | UITabBarButtonLabel:0x159d407d0'Library'
| | | UITabBarButton:0x159d414f0
| | | | UITabBarSwappableImageView:0x159d41d10
| | | | UITabBarButtonLabel:0x159d419f0'Record'
| | | UITabBarButton:0x159d42840
| | | | UITabBarSwappableImageView:0x159d43060
| | | | UITabBarButtonLabel:0x159d42d40'Exports'
| | | UITabBarButton:0x159d43b90
| | | | UITabBarSwappableImageView:0x159d443b0
| | | | UITabBarButtonLabel:0x159d44090'Settings'
| +UITransitionView:0x15b1084e0- AMBIGUOUS LAYOUT for UITransitionView:0x15b1084e0.minX{id: 1503}, UITransitionView:0x15b1084e0.minY{id: 1480}, UITransitionView:0x15b1084e0.Width{id: 1608}, UITransitionView:0x15b1084e0.Height{id: 1481}
| | UIView:0x15b519280
| | *_UIKeyboardLayoutAlignmentView:0x15b518e50- AMBIGUOUS LAYOUT for _UIKeyboardLayoutAlignmentView:0x15b518e50.minY{id: 1478}
| | *_UIAlertControllerView:0x15d815e00- AMBIGUOUS LAYOUT for _UIAlertControllerView:0x15d815e00.minX{id: 1609}, _UIAlertControllerView:0x15d815e00.minY{id: 1610}, _UIAlertControllerView:0x15d815e00.Width{id: 1611}, _UIAlertControllerView:0x15d815e00.Height{id: 1612}
| | | *UIView:0x15b103200- AMBIGUOUS LAYOUT for UIView:0x15b103200.minX{id: 1582}, UIView:0x15b103200.minY{id: 1601}
| | | | *_UIAlertControllerInterfaceActionGroupView:0x15b510760- AMBIGUOUS LAYOUT for _UIAlertControllerInterfaceActionGroupView:0x15b510760.minX{id: 1522}
| | | | | *<_UIContentConstraintsLayoutGuide: 0x15b510c40 - "", layoutFrame = {{0, 0}, {39, 171.66666666666666}}, owningView = <_UIAlertControllerInterfaceActionGroupView: 0x15b510760; frame = (0 0; 0 0); opaque = NO; gestureRecognizers = <NSArray: 0x282061bf0>; layer = <CALayer: 0x282e8dde0>>>
| | | | | *UIView:0x15b510fb0
| | | | | | *_UIInterfaceActionGroupHeaderScrollView:0x15c035000
| | | | | | | *<_UIScrollViewContentOffsetGuide: 0x2817e6140 - "UIScrollView-contentOffsetLayoutGuide", layoutFrame = {{0, 0}, {0, 0}}, owningView = <_UIInterfaceActionGroupHeaderScrollView: 0x15c035000; frame = (0 0; 0 0); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x282060ab0>; layer = <CALayer: 0x282ea68c0>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}>>
| | | | | | | *UIView:0x15b515c10
| | | | | | | | *UIView:0x15b515df0- AMBIGUOUS LAYOUT for UIView:0x15b515df0.minX{id: 1580}, UIView:0x15b515df0.minY{id: 1812}, UIView:0x15b515df0.Height{id: 1813}
| | | | | | | | *UIView:0x15b515fd0- AMBIGUOUS LAYOUT for UIView:0x15b515fd0.minX{id: 1589}, UIView:0x15b515fd0.minY{id: 1814}, UIView:0x15b515fd0.Width{id: 1588}, UIView:0x15b515fd0.Height{id: 1815}
| | | | | | | | *UIView:0x15b5161b0- AMBIGUOUS LAYOUT for UIView:0x15b5161b0.minX{id: 1599}, UIView:0x15b5161b0.minY{id: 1816}
| | | | | | *groupView.actionsSequence...:0x15c032c00
| | | | | | | +actions-separatableSequen...:0x15b511550
| | | | | | | | •actions-separatableSequen...:0x15b511970
| | | | | | | | | *_UIInterfaceActionCustomViewRepresentationView:0x15b10cc30- AMBIGUOUS LAYOUT for _UIInterfaceActionCustomViewRepresentationView:0x15b10cc30.Height{id: 1650}
| | | | | | | | | | +_UIAlertControllerActionView:0x15b516e90
| | | | | | | | | | | *UIView:0x15b517370
| | | | | | | | | | | | *UILabel:0x15b517550'Show devices'
| | | | | | | | | *_UIInterfaceActionItemSeparatorView_iOS:0x15b60c530- AMBIGUOUS LAYOUT for _UIInterfaceActionItemSeparatorView_iOS:0x15b60c530.minY{id: 1725}
| | | | | | | | | | UIView:0x15b60c930
| | | | | | | | | | UIView:0x15b60cb10
| | | | | | | | | *_UIInterfaceActionCustomViewRepresentationView:0x15b60bda0- AMBIGUOUS LAYOUT for _UIInterfaceActionCustomViewRepresentationView:0x15b60bda0.minY{id: 1727}, _UIInterfaceActionCustomViewRepresentationView:0x15b60bda0.Height{id: 1700}
| | | | | | | | | | +_UIAlertControllerActionView:0x15b517840
| | | | | | | | | | | *UIView:0x15b517b20
| | | | | | | | | | | | *UILabel:0x15b517d00'Add device'
| | | | | | | | | *_UIInterfaceActionItemSeparatorView_iOS:0x15b60d3c0- AMBIGUOUS LAYOUT for _UIInterfaceActionItemSeparatorView_iOS:0x15b60d3c0.minY{id: 1729}
| | | | | | | | | | UIView:0x15b60d5c0
| | | | | | | | | | UIView:0x15b60d7a0
| | | | | | | | | *_UIInterfaceActionCustomViewRepresentationView:0x15b60bfe0- AMBIGUOUS LAYOUT for _UIInterfaceActionCustomViewRepresentationView:0x15b60bfe0.minY{id: 1723}, _UIInterfaceActionCustomViewRepresentationView:0x15b60bfe0.Height{id: 1653}
| | | | | | | | | | +_UIAlertControllerActionView:0x15b517ff0
| | | | | | | | | | | *UIView:0x15b5182d0
| | | | | | | | | | | | *UILabel:0x15b5184b0'Cancel'
| | | | | *_UIDimmingKnockoutBackdropView:0x15b512570
| | | | | | UIView:0x15b513340
| | | | | | UIVisualEffectView:0x15b512970
| | | | | | | _UIVisualEffectBackdropView:0x15b512f30
| | | | | | | _UIVisualEffectSubview:0x15b513140
The Constraint issue only seems to happen with an iPhoneX. Ipads and iPhone 7 and 7 plus don't show the the issue.
Thank you.
I got similar issue in iPad.
I fixed it removeing sourceRect and change view.frame to CGRect(x, y, 0, 0).
So, How about removing moreActionsCellSheetController.popoverPresentationController?.sourceRect in your code?
sourceRect means UIAlertController's position. So I think you'd better setting it like CGRect.
Thanks.
If I in Google Sheets have a series defined as
[29060, 29062, 29331, 29332, 29333, 29334, 29335, 29336, 29337, 29338, 29339, 29340, 29341,
29342, 29372, 29373].
How do I make them line up in intervals like this?
|To |From |
|29060 |29062 |
|29331 |29342 |
|29372 |29373 |
I can't find any good answers for this anywhere. Please, help!
Data/Formulas
A1:
29060, 29062, 29331, 29332, 29333, 29334, 29335, 29336, 29337, 29338, 29339, 29340, 29341,
29342, 29372, 29373
B1: =transpose(split(A1,",")). Converts the input text is an a vertical array.
C1: =FILTER(B1:B16,mod(ROW(B1:B16),2)<>0). Returns values in odd rows.
D1: =FILTER(B1:B16,mod(ROW(B1:B16),2)=0). Returns values in even rows.
E1: =ArrayFormula(FILTER(C1:C8,{TRUE();C2:C8<>D1:D7+1})). Returns values that start a range.
F1: =ArrayFormula(FILTER(D1:D8,{D1:D7+2<>D2:D8;TRUE()})). Returns values that end a range.
Result
Note: A1 values are not shown for readability.
+----+---+-------+-------+-------+-------+-------+
| | A | B | C | D | E | F |
+----+---+-------+-------+-------+-------+-------+
| 1 | | 29060 | 29060 | 29062 | 29060 | 29062 |
| 2 | | 29062 | 29331 | 29332 | 29331 | 29342 |
| 3 | | 29331 | 29333 | 29334 | 29372 | 29373 |
| 4 | | 29332 | 29335 | 29336 | | |
| 5 | | 29333 | 29337 | 29338 | | |
| 6 | | 29334 | 29339 | 29340 | | |
| 7 | | 29335 | 29341 | 29342 | | |
| 8 | | 29336 | 29372 | 29373 | | |
| 9 | | 29337 | | | | |
| 10 | | 29338 | | | | |
| 11 | | 29339 | | | | |
| 12 | | 29340 | | | | |
| 13 | | 29341 | | | | |
| 14 | | 29342 | | | | |
| 15 | | 29372 | | | | |
| 16 | | 29373 | | | | |
+----+---+-------+-------+-------+-------+-------+
I have seven elements side by side for which auto layout should calculate its width and the parent view should determine it's height. On this parent view I want to add a line to separate the areas more clearly. When adding this line (a UIView with a background color) I get some black bars at the right side of the parent view (container for the seven elements) and also one of the other views.
If I don't add this line it does work fine on iOS 7. On iOS 8 it does work even when the line is present. These are my auto layout constraints for the line:
V:[line(==0.5)]| and H:|-0-[line]-0-|
The seven labels have the following constraints:
H:|-0-[first][second(==first)][third(==first)][fourth(==first)][fifth(==first)][sixt(==first)][seventh(==first)]-0-|
and
V:|[first]|
and so on.
Why does adding the line not work for iOS 7 auto layout system? How can I add my line correctly?
Edit:
My seven labels are in a container view - the header. The header is placed together with a collection view (added as child view controller) on a normal view controller. This "main" view controller (or container if you want) has the following constraints:
H:|-0-[header]-0-| - header holding the seven labels
H:|-0-[monthView]-0-| - collection view
H:|-0-[toolbar]-0-| - toolbar
V:|-0-[header(==15)][monthView][toolbar(==44)]-0-| - vertical position all three elements
I got it managed to get an auto layout trace once all views where loaded:
*<UIWindow:0x7897f370> - AMBIGUOUS LAYOUT
| *<UILayoutContainerView:0x78eb09f0>
| | *<UINavigationTransitionView:0x78db1b50>
| | | *<UIViewControllerWrapperView:0x78dbb400>
| | | | *<UIView:0x7897c780>
| | | | | *<MonthView_MonthViewHeader:0x78ddd600>
| | | | | | *<UILabel:0x78ddede0>
| | | | | | *<UILabel:0x78de29e0>
| | | | | | *<UILabel:0x78de2a90>
| | | | | | *<UILabel:0x78de2bc0>
| | | | | | *<UILabel:0x78de2de0>
| | | | | | *<UILabel:0x78de3140>
| | | | | | *<UILabel:0x78de3360>
| | | | | | *<UIView:0x78de3580>
| | | | | *<UICollectionViewControllerWrapperView:0x78ebdd00>
| | | | | | *<UICollectionView:0x795c1a00>
| | | | | | | *<MonthView_MonthViewCell:0x78ed1270>
| | | | | | | | <UIView:0x78d2cab0>
| | | | | | | | *<UIView:0x78d2d660>
| | | | | | | | | *<UIView:0x78d2c8b0>
| | | | | | | | | *<UILabel:0x78d2c6a0>
| | | | | | | *<MonthView_MonthViewCell:0x78d29450>
| | | | | | | | <UIView:0x78d290d0>
| | | | | | | | *<UIView:0x78d293f0>
| | | | | | | | | *<UIView:0x78d29020>
| | | | | | | | | *<UILabel:0x78d28f10>
| | | | | | | *<MonthView_MonthViewCell:0x78d27ec0>
| | | | | | | | <UIView:0x78d27c30>
| | | | | | | | *<UIView:0x78d27e60>
| | | | | | | | | *<UIView:0x78d27b80>
| | | | | | | | | *<UILabel:0x78d27a70>
| | | | | | | *<MonthView_MonthViewCell:0x78d26a20>
| | | | | | | | <UIView:0x78d26790>
| | | | | | | | *<UIView:0x78d269c0>
| | | | | | | | | *<UIView:0x78d266e0>
| | | | | | | | | *<UILabel:0x78d265d0>
| | | | | | | *<MonthView_MonthViewCell:0x78d253e0>
| | | | | | | | <UIView:0x78d25170>
| | | | | | | | *<UIView:0x78d25380>
| | | | | | | | | *<UIView:0x78d250c0>
| | | | | | | | | *<UILabel:0x78d24fb0>
| | | | | | | *<MonthView_MonthViewCell:0x78d23f60>
| | | | | | | | <UIView:0x78d23cd0>
| | | | | | | | *<UIView:0x78d23f00>
| | | | | | | | | *<UIView:0x78d23c20>
| | | | | | | | | *<UILabel:0x78d23b10>
| | | | | | | *<MonthView_MonthViewCell:0x78d1ed90>
| | | | | | | | <UIView:0x78d1eb00>
| | | | | | | | *<UIView:0x78d1ed30>
| | | | | | | | | *<UIView:0x78d1ea50>
| | | | | | | | | *<UILabel:0x78d1e940>
| | | | | | | *<MonthView_MonthViewCell:0x78d1d860>
| | | | | | | | <UIView:0x78d1d610>
| | | | | | | | *<UIView:0x78d1d800>
| | | | | | | | | *<UIView:0x78d1d560>
| | | | | | | | | *<UILabel:0x78d1d450>
| | | | | | | *<MonthView_MonthViewCell:0x78d1c3f0>
| | | | | | | | <UIView:0x78d1c160>
| | | | | | | | *<UIView:0x78d1c390>
| | | | | | | | | *<UIView:0x78d1c0b0>
| | | | | | | | | *<UILabel:0x78d1bfa0>
| | | | | | | *<MonthView_MonthViewCell:0x78d1af40>
| | | | | | | | <UIView:0x78d1acb0>
| | | | | | | | *<UIView:0x78d1aee0>
| | | | | | | | | *<UIView:0x78d1ac00>
| | | | | | | | | *<UILabel:0x78d1aaf0>
| | | | | | | *<MonthView_MonthViewCell:0x78d19a90>
| | | | | | | | <UIView:0x78d19800>
| | | | | | | | *<UIView:0x78d19a30>
| | | | | | | | | *<UIView:0x78d19750>
| | | | | | | | | *<UILabel:0x78d19640>
| | | | | | | *<MonthView_MonthViewCell:0x78d185e0>
| | | | | | | | <UIView:0x78d18350>
| | | | | | | | *<UIView:0x78d18580>
| | | | | | | | | *<UIView:0x78d182a0>
| | | | | | | | | *<UILabel:0x78d18190>
| | | | | | | *<MonthView_MonthViewCell:0x78d170c0>
| | | | | | | | <UIView:0x78d16e60>
| | | | | | | | *<UIView:0x78d17060>
| | | | | | | | | *<UIView:0x78d16db0>
| | | | | | | | | *<UILabel:0x78d16ca0>
| | | | | | | *<MonthView_MonthViewCell:0x78d15c40>
| | | | | | | | <UIView:0x78d159b0>
| | | | | | | | *<UIView:0x78d15be0>
| | | | | | | | | *<UIView:0x78d15900>
| | | | | | | | | *<UILabel:0x78d157f0>
| | | | | | | *<MonthView_MonthViewCell:0x78d14790>
| | | | | | | | <UIView:0x78d14500>
| | | | | | | | *<UIView:0x78d14730>
| | | | | | | | | *<UIView:0x78d14450>
| | | | | | | | | *<UILabel:0x78d14340>
| | | | | | | *<MonthView_MonthViewCell:0x78d132e0>
| | | | | | | | <UIView:0x78d13050>
| | | | | | | | *<UIView:0x78d13280>
| | | | | | | | | *<UIView:0x78d12fa0>
| | | | | | | | | *<UILabel:0x78d12e90>
| | | | | | | *<MonthView_MonthViewCell:0x78d11e30>
| | | | | | | | <UIView:0x78d11ba0>
| | | | | | | | *<UIView:0x78d11dd0>
| | | | | | | | | *<UIView:0x78d11af0>
| | | | | | | | | *<UILabel:0x78d119e0>
| | | | | | | *<MonthView_MonthViewCell:0x78d10980>
| | | | | | | | <UIView:0x78d106f0>
| | | | | | | | *<UIView:0x78d10920>
| | | | | | | | | *<UIView:0x78d10640>
| | | | | | | | | *<UILabel:0x78d10530>
| | | | | | | *<MonthView_MonthViewCell:0x78d0f4d0>
| | | | | | | | <UIView:0x78d0f240>
| | | | | | | | *<UIView:0x78d0f470>
| | | | | | | | | *<UIView:0x78d0f190>
| | | | | | | | | *<UILabel:0x78d0f080>
| | | | | | | *<MonthView_MonthViewCell:0x78d0e020>
| | | | | | | | <UIView:0x78d0dd90>
| | | | | | | | *<UIView:0x78d0dfc0>
| | | | | | | | | *<UIView:0x78d0dce0>
| | | | | | | | | *<UILabel:0x78d0dbd0>
| | | | | | | *<MonthView_MonthViewCell:0x78d0c960>
| | | | | | | | <UIView:0x78d0c740>
| | | | | | | | *<UIView:0x78d17190>
| | | | | | | | | *<UIView:0x78d0c690>
| | | | | | | | | *<UILabel:0x78d0c580>
| | | | | | | *<MonthView_MonthViewCell:0x78d0b520>
| | | | | | | | <UIView:0x78d0b290>
| | | | | | | | *<UIView:0x78d0b4c0>
| | | | | | | | | *<UIView:0x78d0b1e0>
| | | | | | | | | *<UILabel:0x78d0b0d0>
| | | | | | | *<MonthView_MonthViewCell:0x78d0a070>
| | | | | | | | <UIView:0x78d09de0>
| | | | | | | | *<UIView:0x78d0a010>
| | | | | | | | | *<UIView:0x78d09d30>
| | | | | | | | | *<UILabel:0x78d09c20>
| | | | | | | *<MonthView_MonthViewCell:0x78d08bc0>
| | | | | | | | <UIView:0x78d08930>
| | | | | | | | *<UIView:0x78d08b60>
| | | | | | | | | *<UIView:0x78d08880>
| | | | | | | | | *<UILabel:0x78d08770>
| | | | | | | *<MonthView_MonthViewCell:0x78d07710>
| | | | | | | | <UIView:0x78d07480>
| | | | | | | | *<UIView:0x78d076b0>
| | | | | | | | | *<UIView:0x78d073d0>
| | | | | | | | | *<UILabel:0x78d072c0>
| | | | | | | *<MonthView_MonthViewCell:0x78d06150>
| | | | | | | | <UIView:0x78d05ec0>
| | | | | | | | *<UIView:0x78d060f0>
| | | | | | | | | *<UIView:0x78d05e10>
| | | | | | | | | *<UILabel:0x78d05d00>
| | | | | | | *<MonthView_MonthViewCell:0x78d04ca0>
| | | | | | | | <UIView:0x78d04a10>
| | | | | | | | *<UIView:0x78d04c40>
| | | | | | | | | *<UIView:0x78d04960>
| | | | | | | | | *<Circle:0x78d3c6b0>
| | | | | | | | | *<UILabel:0x78d04850>
| | | | | | | *<MonthView_MonthViewCell:0x78d037f0>
| | | | | | | | <UIView:0x78d03560>
| | | | | | | | *<UIView:0x78d03790>
| | | | | | | | | *<UIView:0x78d034b0>
| | | | | | | | | *<UILabel:0x78d033a0>
| | | | | | | *<MonthView_MonthViewCell:0x78d02270>
| | | | | | | | <UIView:0x78d01fe0>
| | | | | | | | *<UIView:0x78d02210>
| | | | | | | | | *<UIView:0x78d01f30>
| | | | | | | | | *<UILabel:0x78d01e20>
| | | | | | | *<MonthView_MonthViewCell:0x78d00dc0>
| | | | | | | | <UIView:0x78d00b30>
| | | | | | | | *<UIView:0x78d00d60>
| | | | | | | | | *<UIView:0x78e64000>
| | | | | | | | | *<UILabel:0x78ed2dd0>
| | | | | | | *<MonthView_MonthViewCell:0x78ed3e60>
| | | | | | | | <UIView:0x78ed4130>
| | | | | | | | *<UIView:0x78ed3f00>
| | | | | | | | | *<UIView:0x78ed41e0>
| | | | | | | | | *<UILabel:0x78ed42a0>
| | | | | | | *<MonthView_MonthViewCell:0x78ed5310>
| | | | | | | | <UIView:0x78ed55e0>
| | | | | | | | *<UIView:0x78ed53b0>
| | | | | | | | | *<UIView:0x78ed5690>
| | | | | | | | | *<UILabel:0x78ed5750>
| | | | | | | *<MonthView_MonthViewCell:0x78ed67c0>
| | | | | | | | <UIView:0x78ed6a90>
| | | | | | | | *<UIView:0x78ed6860>
| | | | | | | | | *<UIView:0x78ed6b40>
| | | | | | | | | *<UILabel:0x78ed6c00>
| | | | | | | *<MonthView_MonthViewCell:0x78ed7eb0>
| | | | | | | | <UIView:0x78ed8180>
| | | | | | | | *<UIView:0x78ed7f50>
| | | | | | | | | *<UIView:0x78ed8230>
| | | | | | | | | *<UILabel:0x78ed82f0>
| | | | | | | *<MonthView_MonthViewCell:0x78ed9360>
| | | | | | | | <UIView:0x78ed9630>
| | | | | | | | *<UIView:0x78ed9400>
| | | | | | | | | *<UIView:0x78ed96e0>
| | | | | | | | | *<UILabel:0x78ed97a0>
| | | | | | | *<MonthView_SectionHeader:0x78edb330>
| | | | | | | | *<UIView:0x78eda940>
| | | | | | | | *<UIView:0x78edc740>
| | | | | | | | *<UIView:0x78edc7a0>
| | | | | | | | *<UIView:0x78edca50>
| | | | | | | | *<UIView:0x78edcae0>
| | | | | | | | *<UIView:0x78edcb70>
| | | | | | | | *<UIView:0x78edcc00>
| | | | | | | | *<UILabel:0x78edcc90>
| | | | | | | <UIImageView:0x78df2690>
| | | | | | | <UIImageView:0x78df1c40>
| | | | | | *<MonthView_SectionOverlay:0x78dc8fd0>
| | | | | | | *<GradientView:0x78dcc780>
| | | | | | | *<UILabel:0x78dd3ea0>
| | | | | | *<_UILayoutGuide:0x78dc8a20> - AMBIGUOUS LAYOUT
| | | | | *<MonthView_Toolbar:0x78de7540>
| | | | | | <_UIToolbarBackground:0x78de7c40>
| | | | | | | <_UIBackdropView:0x78d3e940>
| | | | | | | | <_UIBackdropEffectView:0x78d3e730>
| | | | | | | | <UIView:0x78d3e650>
| | | | | | <UIImageView:0x78de8c70>
| | | | | | <UIToolbarTextButton:0x78dfa240>
| | | | | | | <_UIToolbarNavigationButton:0x78df9aa0>
| | | | | | | | <UIButtonLabel:0x78ef69f0>
| | | | | | <UIToolbarTextButton:0x78dfaa50>
| | | | | | | <_UIToolbarNavigationButton:0x78d3eb00>
| | | | | | | | <UIButtonLabel:0x78ef5740>
| | <UINavigationBar:0x78eb1ad0>
| | | <_UINavigationBarBackground:0x78eb2170>
| | | | <_UIBackdropView:0x78db8270>
| | | | | <_UIBackdropEffectView:0x78dba8d0>
| | | | | <UIView:0x78dbb3a0>
| | | | <UIImageView:0x78eb24e0>
| | | <_UINavigationBarBackIndicatorView:0x78eb4f30>
Here you can find the recursive description after the view was loaded.
I think I'll never find out what is wrong with the auto layout system on iOS 7. But I now use a workaround: Instead of adding the line to the same view like the seven labels I add it to another container. Pseudo-Code:
weekdayHeader = [label1]-[label7]
monthViewHeader = [weekdayHeader][line(==0.5)]
And the monthViewHeader is added together with my other views (UICollectionView, UIToolbar) to my main view controller/container.
I want help with my UIScrollView:
I have implemented my UIScrollView in my project and everything works fine but I have problems when Im trying to implement zoom, but this is not as the zoom when we are looking a picture. I am trying to zoom out. My app begins as this graphic when it launches. Lets suppose that I have a UIView in the screen which is bigger than my screen.
--------------------------------------------
| | | |
| | | |
| -----|----------------------|---------|
| | | | |<---------UIView
| | | |<------------------ iPhone Screen frame
| | | | |
| -----|----------------------|---------|
| | | |
| | | |<-------- ScrollView Content size
| | | |
| | | |
| | |<----------------- ScrollView Frame Size
| | | |
| | | |
| | | |
| | | |
| | | |
| ------------------------ |
| |
| |
| |
--------------------------------------------
And I want my screen look like this when I zoom out.
------------------------
| |
| ------------------|
UIView-------->| |
| | |
| ------------------|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
------------------------
How can I do it?
Set scrollView.minimumZoomScale = 0 then you can zoom out as much as you want. If you don't want to zoom out too much, give it a reasonable value.
I am trying to debug a UI Layout and all the elements I have added in the code are labelled with [self.element setTranslatesAutoresizingMaskIntoConstraints:NO]; The only thing that is set in XIB file is the background color of the view (one of many views in a tabbed viewController.
When I look at the NSLog I am seeing the following:
*<UIWindow:0xc352370> - AMBIGUOUS LAYOUT
| *<UILayoutContainerView:0xc3651b0>
| | *<UINavigationTransitionView:0xc355b40>
| | | *<UIViewControllerWrapperView:0xbd3e250>
| | | | *<UILayoutContainerView:0xbd3da60>
| | | | | *<UITransitionView:0xbd46ed0>
| | | | | | *<UIViewControllerWrapperView:0xc09a450>
| | | | | | | *<UIView:0xbd51f40>
| | | | | | | | *<_UILayoutGuide:0xbd51fa0> - AMBIGUOUS LAYOUT
| | | | | | | | *<_UILayoutGuide:0xbd50a10> - AMBIGUOUS LAYOUT
| | | | | | | | *<UIButton:0xc064170> - AMBIGUOUS LAYOUT
| | | | | | | | | *<UIButtonLabel:0xc09d640>
| | | | | | | | *<UILabel:0xc073990> - AMBIGUOUS LAYOUT
| | | | | | | | *<UIButton:0xc0576a0> - AMBIGUOUS LAYOUT
| | | | | | | | | *<UIButtonLabel:0xc095290>
| | | | | | | | *<UIButton:0xc096640> - AMBIGUOUS LAYOUT
| | | | | | | | | <UIButtonLabel:0xc096820>
| | | | | | | | *<UIButton:0xc098b70> - AMBIGUOUS LAYOUT
| | | | | | | | | <UIButtonLabel:0xc098cb0>
| | | | | | | | *<UIButton:0xc09a4c0> - AMBIGUOUS LAYOUT
| | | | | | | | | <UIButtonLabel:0xc09a6d0>
| | | | | | | | *<UILabel:0xc09c9d0> - AMBIGUOUS LAYOUT
| | | | | | | | *<UILabel:0xc09cc60> - AMBIGUOUS LAYOUT
| | | | | | | | *<UIButton:0xc09ce00> - AMBIGUOUS LAYOUT
| | | | | | | | | <UIButtonLabel:0xc09d010>
| | | | | | | | *<UILabel:0xc0a25f0> - AMBIGUOUS LAYOUT
| | | | | | | | *<UIButton:0xc0a2800> - AMBIGUOUS LAYOUT
| | | | | | | | | <UIButtonLabel:0xc0a2a10>
| | | | | | | | *<UILabel:0xc0a5720> - AMBIGUOUS LAYOUT
| | | | | <UITabBar:0xc356c00>
| | | | | | <_UITabBarBackgroundView:0xbe28cc0>
| | | | | | | <_UIBackdropView:0xbe29100>
| | | | | | | | <_UIBackdropEffectView:0xbe296e0>
| | | | | | | | <UIView:0xbe29780>
| | | | | | <UITabBarButton:0xbd42000>
| | | | | | | <UITabBarSwappableImageView:0xbd41050>
| | | | | | | <UITabBarButtonLabel:0xbd43320>
| | | | | | <UITabBarButton:0xbd462e0>
| | | | | | | <UITabBarSwappableImageView:0xbd45d60>
| | | | | | | <UITabBarButtonLabel:0xbd45c70>
| | | | | | <UITabBarButton:0xbd47770>
| | | | | | | <UITabBarSwappableImageView:0xbd48a90>
| | | | | | | <UITabBarButtonLabel:0xbd486c0>
| | | | | | <UITabBarButton:0xbd4c0c0>
| | | | | | | <UITabBarSwappableImageView:0xbd4c220>
| | | | | | | <UITabBarButtonLabel:0xbd4aea0>
| | | | | | <UIImageView:0xbe29ed0>
| | <UINavigationBar:0xc06c4a0>
| | | <_UINavigationBarBackground:0xc05e720>
| | | | <_UIBackdropView:0xc357d70>
| | | | | <_UIBackdropEffectView:0xc3639a0>
| | | | | <UIView:0xc355470>
| | | | <UIImageView:0xc071980>
| | | <UINavigationItemView:0xc074c80>
| | | | <UILabel:0xc083730>
| | | <_UINavigationBarBackIndicatorView:0xc36edb0>
po [
(lldb) po [0xbd51fa0 constraintsAffectingLayoutForAxis:0]
<__NSArrayM 0xbd39190>(
)
(lldb) po [0xbd50a10 constraintsAffectingLayoutForAxis:0]
<__NSArrayM 0x1121f8f0>(
)
(lldb) po [0xc064170 constraintsAffectingLayoutForAxis:0]
<__NSArrayM 0xc0a14e0>(
<NSLayoutConstraint:0xc093aa0 H:|-(NSSpace(20))-[UIButton:0xc064170] (Names: '|':UIView:0xbd51f40 )>,
<NSLayoutConstraint:0xc093b30 UIButton:0xc064170.width == UIButton:0xc0576a0.width>,
<NSLayoutConstraint:0xc093be0 H:[UIButton:0xc064170]-(20)-[UILabel:0xc073990]>,
<NSLayoutConstraint:0xc093c10 UILabel:0xc073990.width == UIButton:0xc0576a0.width>,
<NSLayoutConstraint:0xc096530 H:[UILabel:0xc073990]-(20)-[UIButton:0xc0576a0]>,
<NSLayoutConstraint:0xc096590 H:[UIButton:0xc0576a0]-(NSSpace(20))-| (Names: '|':UIView:0xbd51f40 )>,
<NSAutoresizingMaskLayoutConstraint:0xc0af130 h=--& v=--& H:[UIView:0xbd51f40(768)]>
)
(lldb) po [0xc09a4c0 constraintsAffectingLayoutForAxis:0]
<__NSArrayM 0xc36a0a0>(
<NSLayoutConstraint:0xc09c9a0 H:|-(<=0)-[UIButton:0xc09a4c0] (Names: '|':UIView:0xbd51f40 )>,
<NSContentSizeLayoutConstraint:0xc0ad530 H:[UIButton:0xc09a4c0(110)] Hug:250 CompressionResistance:750>
As you can see from po commands, I am getting NSAutoresizingMasktLayoutContraints. I thought this shouldn't happen?
How can I ensure that I don't get this?
Ok.. I have figured out that the constraints did not appropriately address the relationship between each other. I have updated the code and now I can get clean constraints for all aspects, except for the main UIWindow, which I am sure is just because of the problem with the UILayoutGuide being ambiguous -
*<UIWindow:0xcc6d7f0> - AMBIGUOUS LAYOUT
| *<UILayoutContainerView:0xbd34720>
| | *<UINavigationTransitionView:0xbd4b140>
| | | *<UIViewControllerWrapperView:0xcc48400>
| | | | *<UILayoutContainerView:0xbd5ad40>
| | | | | *<UITransitionView:0xbd635c0>
| | | | | | *<UIViewControllerWrapperView:0xcca68b0>
| | | | | | | *<UIView:0xcc9ddd0>
| | | | | | | | *<_UILayoutGuide:0xcc9de30> - AMBIGUOUS LAYOUT
| | | | | | | | *<_UILayoutGuide:0xcc9e090> - AMBIGUOUS LAYOUT
| | | | | | | | *<UIButton:0xcc9d910>
| | | | | | | | | <UIImageView:0xcc9dd20>
| | | | | | | | *<UILabel:0xcc9e860>
| | | | | | | | *<UIButton:0xcc9ebb0>
| | | | | | | | | <UIImageView:0xcc9eda0>
| | | | | | | | *<UIButton:0xcc9f020>
| | | | | | | | | <UIButtonLabel:0xcc9f470>
| | | | | | | | *<UIButton:0xcca0620>
| | | | | | | | | <UIButtonLabel:0xcca0830>
| | | | | | | | *<UIButton:0xcca15d0>
| | | | | | | | | *<UIButtonLabel:0xcca17e0>
| | | | | | | | *<UILabel:0xcca2580>
| | | | | | | | *<UILabel:0xcca2710>
| | | | | | | | *<UIButton:0xcca28d0>
| | | | | | | | | *<UIButtonLabel:0xcca2ae0>
| | | | | | | | *<UILabel:0xcca3880>
| | | | | | | | *<UILabel:0xcca3bd0>
| | | | | | | | *<UIButton:0xcca3e30>
| | | | | | | | | *<UIButtonLabel:0xcca4040>
| | | | | | | | *<UILabel:0xcca4de0>
| | | | | | | | *<UILabel:0xcca5000>
| | | | | <UITabBar:0xcc69e40>
| | | | | | <_UITabBarBackgroundView:0xcccad10>
| | | | | | | <_UIBackdropView:0xcccb150>
| | | | | | | | <_UIBackdropEffectView:0xcccb730>
| | | | | | | | <UIView:0xcccb7d0>
| | | | | | <UITabBarButton:0xcc96bf0>
| | | | | | | <UITabBarSwappableImageView:0xcc8d330>
| | | | | | | <UITabBarButtonLabel:0xcc8d270>
| | | | | | <UITabBarButton:0xcc98830>
| | | | | | | <UITabBarSwappableImageView:0xcc81840>
| | | | | | | <UITabBarButtonLabel:0xcc983a0>
| | | | | | <UITabBarButton:0xcc9a050>
| | | | | | | <UITabBarSwappableImageView:0xcc8e3e0>
| | | | | | | <UITabBarButtonLabel:0xcc9a130>
| | | | | | <UITabBarButton:0xcc9a560>
| | | | | | | <UITabBarSwappableImageView:0xcc9b140>
| | | | | | | <UITabBarButtonLabel:0xcc9aa20>
| | | | | | <UIImageView:0xcccbf20>
| | <UINavigationBar:0xbd27340>
| | | <_UINavigationBarBackground:0xbd2fc60>
| | | | <_UIBackdropView:0xbd43740>
| | | | | <_UIBackdropEffectView:0xbd2c200>
| | | | | <UIView:0xbd46100>
| | | | <UIImageView:0xbd2ffd0>
| | | <UINavigationItemView:0xbd1e270>
| | | | <UILabel:0xbd283c0>
| | | <_UINavigationBarBackIndicatorView:0xbd566e0>
The UILayoutGuide is not set anywhere in my code, so I am not quite sure what do with it.