Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not showing appropriately in a table view controller #6

Closed
pventura1976 opened this issue Nov 3, 2013 · 7 comments
Closed

Not showing appropriately in a table view controller #6

pventura1976 opened this issue Nov 3, 2013 · 7 comments
Labels

Comments

@pventura1976
Copy link
Contributor

When you call [dateSelectionVC show]in a modal view controller the date selection view controller is shown behind it.

@CooperRS
Copy link
Owner

CooperRS commented Nov 3, 2013

Did you try to use [dateSelectionVC showFromViewController:] and then pass the modal view controller as argument?

@pventura1976
Copy link
Contributor Author

Yes I did. Here is the error that occurs in that case:

2013-11-03 18:19:52.891 FlexList[12264:70b] *** Assertion failure in -[UITableView layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2903.23/UIView.m:8540
2013-11-03 18:19:52.893 FlexList[12264:70b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UITableView's implementation of -layoutSubviews needs to call super.'
*** First throw call stack:
(
    0   CoreFoundation                      0x034415e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x031c48b6 objc_exception_throw + 44
    2   CoreFoundation                      0x03441448 +[NSException raise:format:arguments:] + 136
    3   Foundation                          0x01533fee -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
    4   UIKit                               0x0215233b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 567
    5   libobjc.A.dylib                     0x031d681f -[NSObject performSelector:withObject:] + 70
    6   QuartzCore                          0x01eae2ea -[CALayer layoutSublayers] + 148
    7   QuartzCore                          0x01ea20d4 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    8   QuartzCore                          0x01eb0715 -[CALayer(CALayerPrivate) layoutBelowIfNeeded] + 43
    9   UIKit                               0x02144c76 -[UIView(Hierarchy) layoutBelowIfNeeded] + 595
    10  UIKit                               0x02144a1d -[UIView(Hierarchy) layoutIfNeeded] + 74
    11  FlexList                            0x0001f206 +[RMDateSelectionViewController showDateSelectionViewController:fromViewController:] + 4182
    12  FlexList                            0x00020b0d -[RMDateSelectionViewController showFromViewController:] + 141
    13  FlexList                            0x00054ee9 -[AddFreeArticleViewController openDateSelectionController:] + 169
    14  FlexList                            0x00054fdb -[AddFreeArticleViewController tableView:didDeselectRowAtIndexPath:] + 187
    15  UIKit                               0x021d2d2b -[UITableView _deselectRowAtIndexPath:animated:notifyDelegate:] + 342
    16  UIKit                               0x021d2afe -[UITableView _deselectAllNonMultiSelectRowsAnimated:notifyDelegate:] + 488
    17  UIKit                               0x021c9568 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 928
    18  UIKit                               0x021c9924 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 279
    19  UIKit                               0x021cd908 __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
    20  UIKit                               0x02104183 ___afterCACommitHandler_block_invoke + 15
    21  UIKit                               0x0210412e _applyBlockToCFArrayCopiedToStack + 403
    22  UIKit                               0x02103f5a _afterCACommitHandler + 532
    23  CoreFoundation                      0x034094ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    24  CoreFoundation                      0x0340941f __CFRunLoopDoObservers + 399
    25  CoreFoundation                      0x033e7344 __CFRunLoopRun + 1076
    26  CoreFoundation                      0x033e6ac3 CFRunLoopRunSpecific + 467
    27  CoreFoundation                      0x033e68db CFRunLoopRunInMode + 123
    28  GraphicsServices                    0x0489d9e2 GSEventRunModal + 192
    29  GraphicsServices                    0x0489d809 GSEventRun + 104
    30  UIKit                               0x020e7d3b UIApplicationMain + 1225
    31  FlexList                            0x000028fd main + 141
    32  libdyld.dylib                       0x0398270d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

@CooperRS
Copy link
Owner

CooperRS commented Nov 3, 2013

Ok, I'll take a look at that...

@CooperRS
Copy link
Owner

CooperRS commented Nov 3, 2013

What is the view controller hierarchy of your modal view controller? Do you wrap the modal view controller into a navigation controller?

The crash seems to appear, when showFromViewController: is called with a UITableViewController as argument. In case you wrap your modal view controller into a navigation controller you could call showFromViewController: with the navigation controller as argument. This would be a workaround and should work.

In any case, I'll try to fix the crash when calling showFromViewController with an UITableViewController as argument asap.

@pventura1976
Copy link
Contributor Author

Here is the hierarchy. Let me try passing the navigation controller.
captura de pantalla 2013-11-03 a la s 19 32 11

@pventura1976
Copy link
Contributor Author

Yes! Passing the Navigation View Controller works fine!

- (IBAction)openDateSelectionController:(id)sender
{
    RMDateSelectionViewController *dateSelectionVC = [RMDateSelectionViewController dateSelectionController];
    dateSelectionVC.delegate = self;
    [dateSelectionVC showFromViewController:self.navigationController]; // <--- Here

    //After -[RMDateSelectionViewController show] or -[RMDateSelectionViewController showFromViewController:] has been called you can access the actual UIDatePicker via the datePicker property
    dateSelectionVC.datePicker.datePickerMode = UIDatePickerModeDateAndTime;
    dateSelectionVC.datePicker.minuteInterval = 5;
    dateSelectionVC.datePicker.date = [NSDate dateWithTimeIntervalSinceReferenceDate:0];
}

Log:

2013-11-03 19:41:40.602 FlexList[12688:70b] Successfully selected date: 2013-11-03 18:40:32 +0000

Would be a good idea to update the documentation with this use case; besides catching the previous error.

I tried to add the spanish localization to the xib, but I don't know how, I think I did something wrong. I'll search to see if I'm capable to do it.

@CooperRS
Copy link
Owner

CooperRS commented Nov 3, 2013

Cool! Unfortunately, I am not able to fix the crash showing the date selection view controller from a table view controller due to the way the table view controller works. Actually, this is an iOS issue. I'll prevent that case and update the documentation accordingly. Nevertheless, the workaround does the trick, so this should be fine.

About the localization: A spanish localization is definitely one of my most wanted localizations! If you have problems adding it, you can make a copy of one of the available xibs, open it with Xcode, update the strings, save and send the copy to me. I'll take care of adding it to the project then ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants