My work experience and soon, so I remember things may also be relatively trivial, this is the second to do the Monotouch project, the first project development time is very urgent, and there is no record, now to do the second project, two or three months did not write, found to forget almost, a lot of things have to re-check the information.
Create the first Iphoneviewcontroller:firstview
There is a AppDelegate.cs file under the project root directory. To change the Finishedlaunching method body:
UIWindow window; Public Override BOOLfinishedlaunching (uiapplication app, nsdictionary options) {window=NewUIWindow (UIScreen.MainScreen.Bounds); varRootnavigationcontroller =NewUinavigationcontroller (); Rootnavigationcontroller.pushviewcontroller (NewFristview (),false);//----Set the start Page This. window. Rootviewcontroller =Rootnavigationcontroller; Window. Makekeyandvisible (); return true; }
Jump page is more simple, in the FirstView.cs of the Viewdidload () Add code: (Add a little button properties, these see the individual needs need not set up)
UIButton BTN1 =NewUIButton (); Btn1. Frame=NewRectangleF (Ten, -, -, -); Btn1. Settitle ("Jump", Uicontrolstate.normal); Btn1. Layer.bordercolor=NewMonoTouch.CoreGraphics.CGColor (0.8f,0.8f,0.8f);//Set Border colorBtn1. Layer.borderwidth = 1f;//Set Border WidthBtn1. Layer.cornerradius = 5f;//set border rounded cornersBtn1. Settitlecolor (Uicolor.black, uicontrolstate.normal);//Set Button text colorBtn1. Horizontalalignment=uicontrolcontenthorizontalalignment.center;//Set the button text alignment directionBtn1. Font = Uifont.fromname ("Arial", 14f); Btn1. Touchupinside+ = (sender, e) = ={Secondview View=NewSEcondview(); This. Navigationcontroller.pushviewcontroller (View,true); }; View.addsubview (BTN1);
Effect:
→
The fallback button displays text changes:
This. Navigationitem.setleftbarbuttonitem (New Uibarbuttonitem ("Return", Uibarbuttonitemstyle.plain, (sender, E) =>{this. Navigationcontroller.popviewcontrolleranimated (True);}), True);
Effect:
Monotouch: Start your own created interface and jump for the first time