Hi everybody,
It seems that all of the new users of this community has same problem and that’s create a new first HelloWorld application.
In this topic i’m trying to create a step by step tutorial.
Install AndroidStudio and Multi-Os Engine Plugin
- Install
AndroidStudio v2.3.3
(It seems that we have some problem onversion 3
ofAndroidStudio
). - Go to
AndroidStudio
->Preferences
->Plugins
->Browse Repositories
-> Search forMulti-Os Engine Plugin
Install this plugin and then restartAndroidStudio
Create a (Android) sample project
It is assumed that you have the ability to make a simple Android app.
Create a (iOS) sample project
-
Right click on android module and choose
New
->Multi-Os Engine Module
-
Select
Java > Single View Application
and click next -
Fill your custom project detail and click next
-
Specify the name of your module and click
Finish
For a while, your system freezes , and after the gradle
downloads are finished, the modules are listed for you in this way.
Create first ViewController and connect to storyboard -> (This is equivalent to Activity
in android)
-
Right click on ios module and select
Multi-Os Engine Actions
->Open Project on Xcode
-
In
Xcode
click onMain.storyboard
and drag a view (Label
-Button
-TextField
-…) from right-bottom side ofXcode
and drop onViewController
.
-
Create new
Cocoa Touch
named : SampleViewController
-
Click on
Main.storyboard
and click on top layer ofViewController
and then click onIdentity
tab then fillCustom Class
->Class
value bySampleViewController
and pressEnter key
.
-
Now connect your
Views
toSampleViewController
. Click onShow the Assistant editor
and selectSampleViewController.h
then presscontrol key
+click
onTextField
and release click on the body ofSampleViewController.h
like the below. (Do this by all of other element of yourViewController
) - (For button i selectConnection
type asAction
).
-
Go to
AndroidStudio
again. and on ios module ->ui
package rename class toSampleViewController.java
.
Check these line inSampleViewController
class:
@org.moe.natj.general.ann.Runtime(ObjCRuntime.class)
@ObjCClassName("SampleViewController")
@RegisterOnStartup
@Selector("init")
public native SampleViewController init();
@Owned
@Selector("alloc")
public static native SampleViewController alloc();
protected SampleViewController(Pointer peer) {
super(peer);
}
- Add this following code to
SampleViewController
class:
@Selector("textfield")
@Property
public native UITextField getTextfield();
@Selector("label")
@Property
public native UILabel getLabel();
@Selector("submit:")
public void submit(NSObject sender) {
getLabel().setText(getTextfield().text());
}
- I have the best wishes for you.
- Special thanks of MOE team.