Monotouch: Start your own created interface and jump for the first time

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.