iPhoneã®éçºã¯Xcodeã§Objective-Cããããªå¸¸èãæã¡ç ´ãããæãæ¥ã¾ããã
ãã¨ãã¨VisualStudioããã¼ã¦ã¼ã¶ã¼ã ã£ãåã¨ãã¦ã¯Xcodeã¯ã¾ã ã¾ã è£å®æ©è½ãããã¼ãã¦æ¬å½ã«ãããããã¨ãã§ããã¾ã§å®ç¾©å®ç¾©ã®åµã§ãããããã¦éä¸ã§ããæ°ããªããªã£ã¦ãã¾ãã¾ãã
ãããããã¦ãããã¡ã«MonoTouchã¨ããã©ã¤ãã©ãªãçºè¡¨ããã¾ããã.NETã®ãªã¼ãã³ã½ã¼ã¹å®è£ ããã¦ããMonoããã¸ã§ã¯ãã®å¤éã¨ãã¦éçºãããã.NETã使ç¨ãã¦iPhoneéçºãã§ããããã«ããã©ã¤ãã©ãªã§ãã
.NETã¯ä¸éè¨èªãJITã³ã³ãã¤ã«ããæè¡ãªã®ã§ãããè¨èªå¦çç³»ãiPhoneä¸ã«å®è£ ããã¨è¦ç´éåã¨ãªããAppStoreã§è²©å£²ã§ãã¾ãããããã§ãMonoTouchã§ã¯å ã«å ¨é¨ã³ã³ãã¤ã«ãã¦ãã¾ãã¾ãã*1
Monoã®ååãå ãã¦ãã¾ããã(Novellããï¼*2 )製åã¨ãã¦è²©å£²ãããããã§ããã£ãããªãå¤æ®µããããããªæ°ããã¾ãã»ã»ã»ã
ä»åããã¼ã¿ãã¹ã¿ã¼ã¨ãã¦é¸ã°ããå®éã«è§¦ã£ã¦ã¿ãæ©ä¼ãå¾ã¾ããã®ã§ãå®éã®MonoTouchã§ã®éçºã¯ã©ã®ããã«ãªãã®ããç´¹ä»ãã¾ãã
å¿ è¦ãªãã®
- Leopard以ä¸ã®å ¥ã£ãIntel Mac
- iPhone SDK
- .NETã ããã¨ãã£ã¦Macãä¸è¦ã«ãªãããã§ã¯ãªããå®æ©è»¢éãæçµçãªããã±ã¼ã¸ã³ã°ãªã©ã¯iPhone SDKã«ä¾åããããMacãå¿ è¦ã«ãªãã¾ã
- Mono 2.4
- ä¸è¬ã«é å¸ããã¦ããMonoã®ããã±ã¼ã¸ããã¦ã³ãã¼ããã¦ã»ããã¢ãããã¾ãã
- MonoTouch
- MonoTouchã®SDKã¯pkgå½¢å¼ã®ã¤ã³ã¹ãã¼ã©ã§æä¾ããã¦ãã¾ãããã¦ã³ãã¼ããã¦ã¤ã³ã¹ãã¼ã«ãã¾ãã
- MonoDevelop 2.2 ã¢ã«ãã¡ç (MonoTouch対å¿ç)
- MonoTouchã使ã£ãiPhoneã¢ããªã±ã¼ã·ã§ã³ã®ããã¸ã§ã¯ããä½æã§ããããã«è¨å®ããã¦ãã¾ããMonoTouchã¨ä¸ç·ã«é å¸ããã¦ããã®ã§ã¤ã³ã¹ãã¼ã«ãã¾ãã
MonoDevelopèµ·åãããã¸ã§ã¯ãä½æ
ã¤ã³ã¹ãã¼ã«ãçµãã£ã¦æ©éMonoDevelopãèµ·åãã¦ã¿ã¾ãããã¡ãã¥ã¼ã¨ããæååããã¦ãã¾ãã¾ããっき雑記: MonoDevelop 2.0 AlphaのMac OS X版で日本語を表示する方法ã«ããæ¹æ³ã§å¯¾å¦ãã¾ããã
æ©éiPhoneããã¸ã§ã¯ããä½ã£ã¦ã¿ããã¨æãã¾ãããã¡ã¤ã«âæ°è¦ä½æâã½ãªã¥ã¼ã·ã§ã³ ã§ããC#ã®ã¨ããã«iPhoneã¨ããã®ãããã®ã§ããã®ä¸ãããiPhone MonoTouch Projectããé¸ãã§ã¿ã¾ãã
ãªããåºããã©ã¹ã«ã¼ã
ããã¸ã§ã¯ããã§ãã¾ããã
Hello Worldçãª
ã¨ããããããã¿ã³æ¼ãããã«ã¦ã³ãã¢ããããã¢ããªã§ãã¤ããã¾ãããã*3ããªã¼ä¸ã®xibãã¡ã¤ã«ãããã«ã¯ãªãã¯ããã¨Interface Builderãèµ·åãã¾ãããã¿ã³ã¨ã©ãã«ãããã¾ããã
ã¤ã³ã¹ãã¯ã¿ãéãã¦ãxibã®ã¦ã£ã³ãã¦ããAppDelegateãé¸æãã¾ããä¸çªå³ã®ã¿ãã§Class Outletsã«ã©ãã«ã¨ãã¿ã³ãå®ç¾©ãã¾ãã
ãã®å¾ãAppDelegateãcontrolãã¼æ¼ããªãããã©ãã°ãã¦ããã¿ã³ã¨ã©ãã«ã«ãããããããããã¾ãã
Interface Builderãçµäºãããã¨MonoDevelopã¸æ»ãã¾ããdesigner.csãè¦ã¦ã¿ã¾ãããã
åæã«ããããã£ãçæããã¦ãã¾ãï¼@property(nonatomic, retain) ã»ãã»ãã¨ã@synthesizeã¨ãæ¸ãã¦ãã®ãã¾ã£ããå¿ è¦ãªãï¼ãã£ã±ãããã§ãªããï¼ï¼
ã¨ããã§ãã¢ã¦ãã¬ããã¯å®ç¾©ãã¾ãããã¢ã¯ã·ã§ã³ã¯å®ç¾©ãã¾ããã§ãããã©ãããããMonoTouchã«ã¯åã¢ã¯ã·ã§ã³ã«ã¤ãã³ããå®ç¾©ããã¦ãã¾ãã®ã§ãã³ã¼ãã®èªåè£å®ã§ãã£ããããã¾ããFinishedLaunchingã«è¿½è¨ãã¦ããã¾ãã
ãã£
ãããã£
ãï¼
ããã¼ï¼ãããï¼ããããã¡ã¤ã«ã«IBActionå®ç¾©ãã¦ã¨ããã£ã¦ãã®ãå ¨ãä¸ç¨ï¼æ£ç´controlã¨ã¹ãã¼ã¹ã¨Enterã ãããã°ã³ã¼ãæ¸ããå¢ãã
ã¾ãæçµçã«ããããã³ã¼ãã«ãã¦ããã¾ããã
using System; using System.Collections.Generic; using System.Linq; using MonoTouch.Foundation; using MonoTouch.UIKit; namespace HelloMonoTouch { public class Application { static void Main (string[] args) { UIApplication.Main (args); } } // The name AppDelegate is referenced in the MainWindow.xib file. public partial class AppDelegate : UIApplicationDelegate { int count = 0; // This method is invoked when the application has loaded its UI and its ready to run public override bool FinishedLaunching (UIApplication app, NSDictionary options) { // If you have defined a view, add it here: // window.AddSubview (navigationController.View); pushButton.TouchDown += PushButtonTouchDown; window.MakeKeyAndVisible (); return true; } void PushButtonTouchDown (object sender, EventArgs e) { count++; countLabel.Text = string.Format("Count : {0}", count); } // This method is required in iPhoneOS 3.0 public override void OnActivated (UIApplication application) { } } }
ã§ã¯ãXcodeã¨åãããcommand+enterã§å®è¡ã§ãã
ã§ãã¿ã¼ï¼ï¼ï¼ãã¾ãã®ãã£ããæåã£ã·ãã«æåã
å®æ©è»¢é
å®æ©è»¢éããã«ã¯ãäºåã«Xcodeã§ä½ã£ãã¢ããªã±ã¼ã·ã§ã³ãå®æ©ã«è»¢éã§ããç¶æ ã«ãã¦ããã°ããã¨ã¯ããã¸ã§ã¯ããå³ã¯ãªãã¯ãã¦ãªãã·ã§ã³ãéããiPhone Applicationã®ã¨ããããApplication Signingã«ãã§ãã¯ãå ¥ãã¦ããã¨ãã«ãããã¨ãã«ã³ã¼ããµã¤ã³ãã¦ãããããã«ãªãã¾ãã
å®æ©ãã¤ããªç¨ã«æ§æè¨å®ãå¤æ´ããå¿ è¦ãããã¾ãã表示âãã¼ã«âãã«ããé¸æããã¨ãã«ãæ§æåãæ¿ãç¨ã®ãã¼ã«ãã¼ãåºç¾ãã¾ããããã§ãDebug|iPhoneãé¸æãã¦ããã«ãã¡ãã¥ã¼ããBuild Allãé¸ã³ã¾ãããã®å¾ãå®è¡ã¡ãã¥ã¼ããUpload Deviceãé¸æããã¨å®æ©ã¸è»¢éã§ãã¾ãã
å ¨ä½çãªææ³
ãã£ã±ããå®ç¾©å®ç¾©ã§ãªããªãå ã«é²ããªãiPhoneããã°ã©ã ãä¸æ°ã«æ¥½ã«ãªããªã¼ã£ã¦ã®ãæãã¾ããã
C#ã使ãã¦ä¸»ãªã¯ã©ã¹ã©ã¤ãã©ãªãã»ã¨ãã©ä½¿ããã¨ããäºã¯ãWMã¨ã®ã¯ãã¹éçºã夢ã§ã¯ããã¾ããã
ãã¨ãæ°å¹´åã¾ã§ããªãå¾®å¦ã ã£ãMonoDevelopãæãã®ã»ã使ãç©ã«ãªã£ã¦ãã®ã«ã³ã£ãããã³ã¼ãè£å®ãIntelliSenseã°ãã«åãã¦å ¨ç¶ã¾ã¨ãã«ãããã¼ãããObjective-Cæ¸ããããªããªã£ã¦ããã»ã»ã»ã
æ大ã®æ¸å¿µç¹ã¯ãã®ã©ã¤ãã©ãªã®å¤æ®µããã£ãããããã«ãªããã ããã»ã»ã»