新建一个空工程,如图

新建类

using System;
using UIKit; namespace TabbedApplication
{
public class TabController : UITabBarController
{
UIViewController tab1,tab2,tab3; public TabController ()
{
tab1 = new UIViewController();
tab1.Title = "Green";
tab1.View.BackgroundColor = UIColor.Green;
tab1.TabBarItem = new UITabBarItem (UITabBarSystemItem.Favorites, 0); tab2 = new UIViewController();
tab2.Title = "Orange";
tab2.View.BackgroundColor = UIColor.Orange;
tab2.TabBarItem.Image = UIImage.FromFile ("second.png");
tab2.Title = "Second"; tab3 = new UIViewController();
tab3.Title = "Red";
tab3.View.BackgroundColor = UIColor.Red;
tab3.TabBarItem.BadgeValue = "Hi";
var tabs = new UIViewController[] {
tab1, tab2, tab3
}; ViewControllers = tabs;
}
}
}

  修改 AppDelegate.cs

using System;
using System.Collections.Generic;
using System.Linq; using Foundation;
using UIKit; namespace TabbedApplication
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;
TabController tabController;
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds); // If you have defined a root view controller, set it here:
// window.RootViewController = myViewController;
tabController=new TabController();
window.RootViewController = tabController;
// make the window visible
window.MakeKeyAndVisible (); return true;
}
}
}

  运行程序

Creating Tabbed Applications的更多相关文章

  1. Visual Studio跨平台开发实战(3) - Xamarin iOS多页面应用程式开发

    原文 Visual Studio跨平台开发实战(3) - Xamarin iOS多页面应用程式开发 前言 在前一篇教学中, 我们学会如何使用Visual Studio 搭配Xcode 进行iOS基本控 ...

  2. HDevEngine in .NET Applications MultiThreading

    Basics To use HDevEngine in Visual Studio .NET, you must add a reference to the HALCON/.NET assembly ...

  3. HTML5 Differences from HTML4

    Abstract "HTML5 Differences from HTML4" describes the differences of the HTML5 specificati ...

  4. (转) [it-ebooks]电子书列表

    [it-ebooks]电子书列表   [2014]: Learning Objective-C by Developing iPhone Games || Leverage Xcode and Obj ...

  5. Java资源大全中文版(Awesome最新版)

    Awesome系列的Java资源整理.awesome-java 就是akullpp发起维护的Java资源列表,内容包括:构建工具.数据库.框架.模板.安全.代码分析.日志.第三方库.书籍.Java 站 ...

  6. DotNet 资源大全中文版(Awesome最新版)

    Awesome系列的.Net资源整理.awesome-dotnet是由quozd发起和维护.内容包括:编译器.压缩.应用框架.应用模板.加密.数据库.反编译.IDE.日志.风格指南等. 算法与数据结构 ...

  7. Orchard教程索引页

    Orchard官方教程(译)索引 链接标注 原文 则表示未译,其他带有中文标题的表示译文内容. 入门 安装Orchard--Installing Orchard 通过zip包手动安装Orchard-- ...

  8. 使用NW.js封装微信公众号菜单编辑器为桌面应用

    开发微信公众号的朋友都会遇到一个常见的需求就是修改自定义菜单,如果每个人都去开发这个不经常使用的功能确实有点浪费时间.前段时间在github上找到一个仿企业号的菜单编辑界面,结合微信的C# SDK开发 ...

  9. 【转】Controllers and Routers in ASP.NET MVC 3

    Controllers and Routers in ASP.NET MVC 3 ambilykk, 3 May 2011 CPOL 4.79 (23 votes) Rate: vote 1vote ...

随机推荐

  1. 如何从sql server导出到csv文件

    如何从sql server导出到csv文件,具体代码如下: private static void WriteHeader(SqlDataReader reader, TextWriter outpu ...

  2. GridControl 控制列中的控件显示

    一.需求描述 根据条件判断Checkbox的显示,先上个图,, 类似Demo中的这个,因为不能控制文本的显示,所以需对该列的其它事件做些处理,  二.解决方案 1.添加GridControl上需要的控 ...

  3. C#学习笔记---区分StringWriter(Reader)和StreamWriter(Reader),TextWriter(Reader),BinaryWriter(Reader)

    1.TextWriter(Reader)分别是对连续字符系列处理的编写器(读写器),来自System.IO 2.StringWriter(Reader)继承TextWriter(Reader),它主要 ...

  4. HDU 1394:Minimum Inversion Number(树状数组,线段树)[水]

    题意:有0~n-1这n个数,以一定的排列.这个排列可以循环,就是可以把第一个拿到最后,然后形成新的排列.问这些排列中的逆序对最小值. 思路: 最后的循环,拿走一个之后,新的逆序对数 newsum = ...

  5. 微信小程序 赋值问题

    通常我们在页面跳转传递过来的参数要用到页面渲染时或是请求接口回来的数据要用到页面渲染时 对page的data赋值可不能用简单的变量赋值,要用微信小微信专有的this.setData方法 Page({ ...

  6. [原创][SW]一些实用软件的小tips(长期更新)

    0. 简介 生活中我们经常使用许多的小工具或软件,来提高我们的工作效率,比如UltraEdit.Notepad++等.本文主要做一些记录,目的呢就是防止自己遗忘或者是快速的查询,来源是自己的摸索和网络 ...

  7. Network | Public-key cryptography

    公开密钥加密public-key cryptography,也称为非对称(密钥)加密. 非对称密钥,是指一对加密密钥与解密密钥,这两个密钥是数学相关,用某用户密钥加密后所得的信息,只能用该用户的解密密 ...

  8. springboot 集成 freemarker

    前面我们已经实现了thymeleaf模板,其实freemarker和thymeleaf差不多,都可以取代JSP页面,实现步骤也差不多,我们来简单实现一下 引入pom.xml依赖如下 <depen ...

  9. Spring Boot中实现异步调用之@Async

    一.什么是异步调用 “异步调用”对应的是“同步调用”,同步调用指程序按照定义顺序依次执行,每一行程序都必须等待上一行程序执行完成之后才能执行:异步调用指程序在顺序执行时,不等待异步调用 的语句返回结果 ...

  10. 小程序使用wxParse插件解析html标签图片间距问题

    转自:https://www.cnblogs.com/likun123/p/9543376.html 小程序解析html标签,就需要用到wxParse啦.但是在解析连续图片的时候,会发现图片之间会有间 ...