Skip to content

Instantly share code, notes, and snippets.

@abuisman
Created September 16, 2011 12:15
Show Gist options
  • Save abuisman/1221992 to your computer and use it in GitHub Desktop.
Save abuisman/1221992 to your computer and use it in GitHub Desktop.
/**
* Create an input for a date that gets filled in by a datepicker in a modal window.
*/
createModalDatePickerInput: function(){
var field = Ti.UI.createTextField({
width: '90%',
height: 35,
borderStyle: Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
field.addEventListener('focus', function(){
var subWin = Titanium.UI.createWindow({
navBarHidden:true,
layout: 'vertical'
});
var datePicker = Titanium.UI.createPicker({
useSpinner: true,
type: Titanium.UI.PICKER_TYPE_DATE,
top: 10,
});
subWin.add(datePicker);
var doneButton = Ti.UI.createButton({
title: 'Klaar',
height: 35,
width: '90%',
top: 10
});
subWin.add(doneButton);
subWin.open({
modal: true,
modalTransitionStyle: Ti.UI.iPhone.MODAL_TRANSITION_STYLE_COVER_VERTICAL,
modalStyle: Ti.UI.iPhone.MODAL_PRESENTATION_FORMSHEET
});
doneButton.addEventListener('click', function(){
//field.fireEvent('blur', {value: datePicker.value});
subWin.close();
});
field.addEventListener('blur', function(e){
//field.value = e.value;
});
}); // end the event handler def.
return field;
}
@abuisman
Copy link
Author

2011-09-16 14:24:31.310 ZizoPrototype[35999:13a03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing the same view controller instance more than once is not supported (<TiViewController: 0x6aaf870>)'

*** Call stack at first throw:

(

0   CoreFoundation                      0x0238b5a9 __exceptionPreprocess + 185

1   libobjc.A.dylib                     0x024df313 objc_exception_throw + 44

2   UIKit                               0x009d0340 -[UINavigationController pushViewController:transition:forceImmediate:] + 386

3   UIKit                               0x009c91c4 -[UINavigationController pushViewController:animated:] + 62

4   ZizoPrototype                       0x001829c4 -[TiUIiPhoneNavigationGroup open:withObject:] + 292

5   ZizoPrototype                       0x00181375 -[TiUIiPhoneNavigationGroupProxy open:] + 805

6   Foundation                          0x0068f94e __NSThreadPerformPerform + 251

7   CoreFoundation                      0x0236c8ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15

8   CoreFoundation                      0x022ca88b __CFRunLoopDoSources0 + 571

9   CoreFoundation                      0x022c9d86 __CFRunLoopRun + 470

10  CoreFoundation                      0x022c9840 CFRunLoopRunSpecific + 208

11  CoreFoundation                      0x022c9761 CFRunLoopRunInMode + 97

12  GraphicsServices                    0x041911c4 GSEventRunModal + 217

13  GraphicsServices                    0x04191289 GSEventRun + 115

14  UIKit                               0x0091ec93 UIApplicationMain + 1160

15  ZizoPrototype                       0x000043da main + 410

16  ZizoPrototype                       0x00002ca5 start + 53

)

terminate called throwing an exception

@abuisman
Copy link
Author

Subwin.close():

2011-09-16 14:26:48.637 ZizoPrototype[36057:13a03] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempting to begin a modal transition from <UINavigationController: 0x6e368e0> to <UINavigationController: 0x6d3eaf0> while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed'

*** Call stack at first throw:

(

0   CoreFoundation                      0x0238b5a9 __exceptionPreprocess + 185

1   libobjc.A.dylib                     0x024df313 objc_exception_throw + 44

2   CoreFoundation                      0x02343ef8 +[NSException raise:format:arguments:] + 136

3   Foundation                          0x0070b3bb -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116

4   UIKit                               0x00bbf1d6 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 290

5   UIKit                               0x009c465d -[UIViewController presentModalViewController:withTransition:] + 3478

6   ZizoPrototype                       0x00197d96 -[TiApp attachModal:toController:animated:] + 166

7   ZizoPrototype                       0x00197dd1 -[TiApp attachModal:toController:animated:] + 225

8   ZizoPrototype                       0x00197cda -[TiApp showModalController:animated:] + 474

9   ZizoPrototype                       0x00062e65 -[TiWindowProxy openOnUIThread:] + 2933

10  Foundation                          0x0068f94e __NSThreadPerformPerform + 251

11  CoreFoundation                      0x0236c8ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15

12  CoreFoundation                      0x022ca79d __CFRunLoopDoSources0 + 333

13  CoreFoundation                      0x022c9d86 __CFRunLoopRun + 470

14  CoreFoundation                      0x022c9840 CFRunLoopRunSpecific + 208

15  CoreFoundation                      0x022c9761 CFRunLoopRunInMode + 97

16  GraphicsServices                    0x041911c4 GSEventRunModal + 217

17  GraphicsServices                    0x04191289 GSEventRun + 115

18  UIKit                               0x0091ec93 UIApplicationMain + 1160

19  ZizoPrototype                       0x000043da main + 410

20  ZizoPrototype                       0x00002ca5 start + 53

21  ???                                 0x00000001 0x0 + 1

)

terminate called throwing an exception

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment