zoukankan      html  css  js  c++  java
  • 1.创建monotouch iphone 或iPad项目步骤

    1.创建含有故事版类型的项目

    2.创建以后所看到的内容:

    3.打开故事版:原有的视图删掉,改用Navigation Controller,用于导航界面,Relationship连接新建的页面。

    4.对新建的界面生成Class,如图所示:

    点击回车,保存以后在解决方案下就会看到自动生成的SubMaincontroller.cs,我们把这个页面作为界面导航入口。

    5.创建新的界面,我认为使用xib是比较方便的,当然也可以在故事版中接着创建界面,先介绍单独的xib。

    添加新建文件——MonoTouch——IPhone View Controller,命名Page1后新建保存。

    此时我们会看到三个文件,如图:

    我们实现功能就需要在Page1.cs中写入代码,Xib就用来设计界面的,Xib设计界面的原理就入Winform一样。

    6.界面创建完成以后,需要知道的最基本就是如何跳转界面,两个界面的跳转代码如下:

    this.NavigationController.PushViewController(new Page1(),true);

    返回上一页:

    this.NavigationController.PopToRootViewController(true);

     一般xib中会默认显示导航栏,如果有返回页,会自动显示出Back按钮,可供返回。

     7.如果使用故事板进行界面排列,我们就需要打开故事板,把需要添加的界面一个个手动拖到故事版中,并命名Class回车保存,只是导航方法就不一样了,你可以在故事板中右键拖动创建push的suage,如果需要可以使用代码进行跳转,代码如下:

    public static void NavategiteToSettings (UINavigationController controller)
            {
                if(controller==null)return;
                UIStoryboard board=UIStoryboard.FromName("MainStoryboard",null);
                UIViewController setting=(UIViewController)board.InstantiateViewController("Settings");
                controller.PushViewController(setting,true);
            }

     创建IPad 项目,步骤也是如此。只是创建的是对用iPad的界面和项目。

  • 相关阅读:
    [JSOI2007][BZOJ1031] 字符加密Cipher|后缀数组
    leetcode Flatten Binary Tree to Linked List
    leetcode Pascal's Triangle
    leetcode Triangle
    leetcode Valid Palindrome
    leetcode Word Ladder
    leetcode Longest Consecutive Sequence
    leetcode Sum Root to Leaf Numbers
    leetcode Clone Graph
    leetcode Evaluate Reverse Polish Notation
  • 原文地址:https://www.cnblogs.com/Cindys/p/2971662.html
Copyright © 2011-2022 走看看