Dear MOE teams,
I want to create an empty iOS application, just like the following code, How can I do this? because MOE declare a UIWindow, and setWindow,…
I want to create the UIWindow by myself. But it seems MOE create the window for me, what should I do?
Do I need to delete the luanchScreen and main.storyborad?
thanks!
package ttt;
import apple.NSObject;
import apple.coregraphics.struct.CGRect;
import apple.foundation.NSDictionary;
import apple.uikit.UIApplication;
import apple.uikit.UIColor;
import apple.uikit.UILabel;
import apple.uikit.UIScreen;
import apple.uikit.UIViewController;
import apple.uikit.UIWindow;
import apple.uikit.c.UIKit;
import apple.uikit.enums.UITextAlignment;
import apple.uikit.protocol.UIApplicationDelegate;
import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.RegisterOnStartup;
import org.moe.natj.objc.ann.Selector;
@RegisterOnStartup
public class Main extends NSObject implements UIApplicationDelegate {
public static void main(String[] args) {
UIKit.UIApplicationMain(0, null, null, Main.class.getName());
}
@Selector("alloc")
public static native Main alloc();
protected Main(Pointer peer) {
super(peer);
}
private UIWindow window;
@Override
public boolean applicationDidFinishLaunchingWithOptions(UIApplication application, NSDictionary launchOptions) {
//application.setStatusBarHidden(true);
CGRect rect = UIScreen.mainScreen().applicationFrame();
UIWindow nwindow = UIWindow.alloc().initWithFrame(rect);
nwindow.setBackgroundColor(UIColor.blueColor());
rect.origin().setX(0);
rect.origin().setY(0);
UILabel label = UILabel.alloc().initWithFrame(rect);
label.setText("Hello,world!");
label.setTextAlignment(UITextAlignment.Center);
nwindow.addSubview(label);
nwindow.makeKeyAndVisible();
nwindow.setRootViewController(UIViewController.alloc().initWithNibNameBundle(null, null));
return true;
}
@Override
public void setWindow(UIWindow value) {
window = value;
}
@Override
public UIWindow window() {
return window;
}
}