Created
August 25, 2014 13:28
-
-
Save taktamur/f1238bb90b34fd79efe6 to your computer and use it in GitHub Desktop.
Xamarinで遊ぶ(1) 起動するまでのメモ書き ref: http://qiita.com/paming/items/1bb43f55033dc78eb0b9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| //using System.Collections.Generic; | |
| //using System.Linq; | |
| using MonoTouch.Foundation; // NSxxxはこっちに入っている? | |
| using MonoTouch.UIKit; // UIxxxはこっちに入っている | |
| // https://xamarin.com/getting-started/ios にあるサンプル、Taskyを自力で作っていく | |
| // | |
| // XamarinStudio用のgitignoreの作り方 | |
| // $git ignore xamarinstudio > .gitignore | |
| namespace MyTasky | |
| { | |
| // ↓ここを削ると起動しない。おそらく"objc側でのクラス登録"だと思うけど、[] の意味が分からない | |
| [MonoTouch.Foundation.Register ("AppDelegate")] | |
| // ここのクラス名が、↑のRegisterとずれていても、objc的には↑のクラス名として登録されてるみたい。 | |
| public partial class MyAppDelegate : UIApplicationDelegate | |
| // "partial" 部分型宣言 1つの型を複数のファイルで宣言できる。 | |
| // http://msdn.microsoft.com/ja-jp/library/wa80x488.aspx | |
| { | |
| UIWindow window; | |
| // 親クラスのメソッドをオーバーライドする時には、overrideが必要。無いとwarning & 真っ黒画面 | |
| public override bool FinishedLaunching (UIApplication app, NSDictionary options) | |
| { | |
| window = new UIWindow (UIScreen.MainScreen.Bounds); | |
| // UIViewController vc = new UIViewController (); | |
| var vc = new UIViewController (); // 型推論でvarでいける | |
| vc.View.BackgroundColor = UIColor.Blue; | |
| UINavigationController navVC = new UINavigationController (); | |
| navVC.PushViewController (vc, false); | |
| // If you have defined a root view controller, set it here: | |
| window.RootViewController = navVC; | |
| // make the window visible | |
| this.window.MakeKeyAndVisible (); | |
| return true; | |
| } | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using MonoTouch.Foundation; | |
| using MonoTouch.UIKit; | |
| namespace MyTasky | |
| { | |
| public class Application | |
| { | |
| // This is the main entry point of the application. | |
| static void Main (string[] args) | |
| { | |
| // if you want to use a different Application Delegate class from "AppDelegate" | |
| // you can specify it here. | |
| UIApplication.Main (args, null, "AppDelegate"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment