Code Monkey home page Code Monkey logo

Comments (7)

CooperRS avatar CooperRS commented on July 21, 2024

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

from rmdateselectionviewcontroller.

pventura1976 avatar pventura1976 commented on July 21, 2024

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

from rmdateselectionviewcontroller.

CooperRS avatar CooperRS commented on July 21, 2024

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

from rmdateselectionviewcontroller.

CooperRS avatar CooperRS commented on July 21, 2024

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.

from rmdateselectionviewcontroller.

pventura1976 avatar pventura1976 commented on July 21, 2024

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

from rmdateselectionviewcontroller.

pventura1976 avatar pventura1976 commented on July 21, 2024

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.

from rmdateselectionviewcontroller.

CooperRS avatar CooperRS commented on July 21, 2024

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 ;).

from rmdateselectionviewcontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.