3 ms·
The NativeScript site says that I can use their cross-platform wrappers like Button, which delegates to UIButton on iOS and android.whatever.Button on Android.
by kartickv 10y ago
The NativeScript site says that I can use their cross-platform wrappers like Button, which delegates to UIButton on iOS and android.whatever.Button on Android. So far, so good. But suppose I now want to invoke some method on Button that exists only on iOS. Can I do that? If not, it's the least-common-denominator, which I'm not interested in using to build an app. I'm thinking about something like:
var button = new Button(...);
// Set the common properties:
button.backgroundColor = ...;
button.text = ...;
if (iOS) {
// Set iOS-specific properties
} else {
// Set Android-specific properties
}
- dbbk 10y agoYes, it literally works like that. See the docs: http://docs.nativescript.org/cookbook/application http://docs.nativescript.org/cookbook/application The variable is app.ios / app.android