MoSync native UI and deployment
Does anybody know if it's possible to use MoSync to create apps with a native UI?
From what I can tell all the UI/graphics is done with their own UI library and don't the the native ui elements.Also, now that I'm creating a question anyway. Why does MoSync target specific telephones? Is it not possible to just create a generic install package for whatever platform you're targeting? (like .apk files for android). If开发者_开发问答 it's possible it should make distribution easier.
The standard way up til now has been to create a custom non-native UI through the MAUI library. As of 2011-02-03 there is an experimental native UI framework for Android and iPhone. The user documentation is however rather non-existent, so you will have to check the source code for more information. I'll point you in the right direction, for accessing native widgets you use the maWidget* system calls defined in: maapi.idl. For a list of available widgets and properties see: Types.java. Note that this API is likely to change and be expanded.
A simple native UI example:
#include <MAUtil/Moblet.h>
#include <IX_WIDGET.h>
class NativeUIMoblet : public MAUtil::Moblet
{
public:
NativeUIMoblet()
{
// Create a screen
MAHandle mainScreen = maWidgetCreate( "Screen" );
// Create a 'Hello World' label
MAHandle helloLabel = maWidgetCreate( "Label" );
maWidgetSetProperty( helloLabel, "text", "Hello World!" );
// Add the label to the screen
maWidgetAddChild( mainScreen, helloLabel );
// Show the screen
maWidgetScreenShow( mainScreen );
}
void keyPressEvent(int keyCode, int nativeCode)
{
}
void keyReleaseEvent(int keyCode, int nativeCode)
{
}
};
extern "C" int MAMain()
{
MAUtil::Moblet::run( new NativeUIMoblet( ) );
return 0;
};
Presently, there is no emulator support available, so you will have to run it on a device or in a specific SDKs emulator.
The reason for targeting a specific phone is that there exists bugs specific to a certain device. But in the recent nightly builds of MoSync you can build for generic platforms like Android 2.1.
http://www.mosync.com/blog/2011/03/using-nativeeditbox
精彩评论