Closed adamrenklint closed 12 years ago
Hi Adam!
Do you create the style file before launching the app? By "force an update", do you mean just saving the style file or do you mean something else?
I'm not sure yet whether this is a bug or a miss in some way, but it sounds like something that's meant to work.
Cheers /J
Hej Jacob, The file, with the same name as the module is created before I build and launch. Any class styles I define in that file appears to work fine, even using the modules "type-class", in this example .CustomWindow.
Yes, exactly - saving the file, forcing the styles to be re-examined.
Hejsan! :-)
Unfortunately, I can't seem to reproduce your issue. Could you please provide your Resources folder or any simplified case where this behaviour occurs?
Sure, this link is a modified version of the demo app, where I have just added a style file for shims window module. http://adamrenklint.com/kranium/Resources.zip
This should now be fixed in master. You can try pulling it and replace your kranium.js with the new one found in dist/.
I'm not ready to push this to npm until it has been tested further. Please have a go and let me know how it works out for you!
Replacing the current kranium.js in /lib makes the demo app crash at startup with the error:
2011-09-29 22:26:44.317 kranium-demo2[96360:13a03] *\ Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary supportsNavBarPositioning]: unrecognized selector sent to instance 0x8834f90'
*\ Call stack at first throw:
(
0 CoreFoundation 0x025c15a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02715313 objc_exception_throw + 44
2 CoreFoundation 0x025c30bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x02532966 ___forwarding___ + 966
4 CoreFoundation 0x02532522 _CF_forwarding_prep_0 + 50
5 kranium-demo2 0x00089236 -[TiUIWindowProxy setLeftNavButton:withObject:] + 1302
6 kranium-demo2 0x0008c49f -[TiUIWindowProxy setupWindowDecorations] + 2095
7 kranium-demo2 0x0008cded -[TiUIWindowProxy _tabBeforeFocus] + 77
8 kranium-demo2 0x0009e4b2 -[TiUITabProxy handleWillShowViewController:] + 786
9 kranium-demo2 0x0009e6f9 -[TiUITabProxy navigationController:willShowViewController:animated:] + 105
10 UIKit 0x009d4ac7 -[UINavigationController _startTransition:fromViewController:toViewController:] + 1123
11 UIKit 0x009cf32a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
12 UIKit 0x00aea2e9 -[UILayoutContainerView layoutSubviews] + 226
13 QuartzCore 0x01a7aa5a -[CALayer layoutSublayers] + 181
14 QuartzCore 0x01a7cddc CALayerLayoutIfNeeded + 220
15 QuartzCore 0x01a220b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
16 QuartzCore 0x01a23294 _ZN2CA11Transaction6commitEv + 292
17 QuartzCore 0x01a2346d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
18 CoreFoundation 0x025a289b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
19 CoreFoundation 0x025376e7 __CFRunLoopDoObservers + 295
20 CoreFoundation 0x025001d7 __CFRunLoopRun + 1575
21 CoreFoundation 0x024ff840 CFRunLoopRunSpecific + 208
22 CoreFoundation 0x024ff761 CFRunLoopRunInMode + 97
23 GraphicsServices 0x041971c4 GSEventRunModal + 217
24 GraphicsServices 0x04197289 GSEventRun + 115
25 UIKit 0x00924c93 UIApplicationMain + 1160
26 kranium-demo2 0x0000496a main + 410
27 kranium-demo2 0x00003195 start + 53
)
Oh my. I screwed up! Sorry about that!
The problem was that my changes made the shims
window considered to be only of type shims
, so the special logic regarding window
wasn't triggered. This meant that plain javascript objects were left on the leftNavButton
and rightNavButton
properties, which makes Titanium crash and burn since these must be instantiated TiUIElements
or null
.
The shims
element is now of element type window
and custom type shims
. This should mean that it will be stylable using either window {}
or shims {}
and also selectable using K("window")
or K("shims")
.
Please try with the new dist/kranium.js
and see if it works for you!
Now it works perfectly, thanks!
If I create a custom Window class, for example CustomWindow, and add a rule in that modules style file, it won't be applied to the instantiated element until I save the file and force an update. Maybe this is intended behavior?