iOS navigationbar添加实现

#ViewController.m

- (void)viewWillAppear:(BOOL)animated{

[super viewWillAppear:animated];

UIViewController *rootView = [[UIViewController alloc] init];

rootView.title = @"Root View";

self.navController = [[UINavigationController alloc] init];

[self.navController pushViewController:rootView animated:YES];

[self.view addSubview:self.navController.view];

self.navigationController.navigationBarHidden = YES;

UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(selectLeftAction:)];

leftButton.title = @"123";

rootView.navigationItem.leftBarButtonItem = leftButton;

UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd  target:self action:@selector(selectRightAction:)];

rootView.navigationItem.rightBarButtonItem = rightButton;

}

时间: 2024-08-24 20:30:55

iOS navigationbar添加实现的相关文章

DKNightVersion 的实现 --- 如何为 iOS 应用添加夜间模式

在很多重阅读或者需要在夜间观看的软件其实都会把夜间模式当做一个 App 所需要具备的特性. 而如何在不改变原有的架构, 甚至不改变原有的代码的基础上, 就能为应用优雅地添加夜间模式就成为一个在很多应用开发的过程中不得不面对的一个问题. 就是以上事情的驱动, 使我思考如何才能使用一种优雅并且简洁的方法解决这一问题. 而 DKNightVersion 就是我带来的解决方案. 到目前为止, 这个框架的大部分的工作都已经完成了, 或许它现在不够完善, 不过我会持续地维护这个框架, 帮助饱受实现夜间模式之

Unity3D IOS IPhone添加Admob的方法

原地址:http://dong2008hong.blog.163.com/blog/static/4696882720140403119293/ 首先阅读官方文档https://developers.google.com/mobile-ads-sdk/docs/ 按步就班注册获取AdMob Publisher ID已及开发SDK包和DEMO工程,确保官方的demo工程能正确运行: 如果没法运行,再仔细阅读官方文档!! 为了省事,就直接在BannerExampleViewController上修改

iOS平台添加Google Admob -2/2(Unity3D开发之八)

猴子原创,欢迎转载.转载请注明: 转载自Cocos2D开发网–Cocos2Dev.com,谢谢! 原文地址: http://www.cocos2dev.com/?p=572 在上一篇文章中主要是编写了iOS Admob的接口实现.那么现在我们要做的事就是在unity中调用iOS Admob并展示. 一.实现Unity中对外接口,内部负责调用iOS Admob接口.LHiOSAdmob.cs using UnityEngine; using System.Collections; using Sy

iOS平台添加Google Admob -1/2(Unity3D开发之七)

猴子原创,欢迎转载.转载请注明: 转载自Cocos2D开发网–Cocos2Dev.com,谢谢! 原文地址: http://www.cocos2dev.com/?p=567 Unity调用iOS还是非常简单的,晚上空闲时间写了unity在IOS平台加载Google Admob.需要的朋友可以看下. 一.首先编写Admob的iOS的代码.请去https://apps.admob.com下载iOS Admob SDK, 并注册app id.如果这一步不熟悉,请自行Google,网上应该很多. 1.I

给iOS程序添加push代码

给iOS程序添加push代码 Adding Code for a Push Enabled iOS Application 现在,我们开始开发项目,为了使该App能够接受push通知,我们需要对程序进行一些修改. We are now ready to start programming. We need to make a few modification to the app delegate in order to receive push notifications. 1. 给当前设备注

Xamarin SQLite教程Xamarin.iOS项目添加引用

Xamarin SQLite教程Xamarin.iOS项目添加引用 使用直接方式访问SQLite数据库,需要将System.Data和Mono.Data.SQlite库导入到创建的项目中.下面将分别讲解在Xamarin.iOS和Xamarin.Android项目中添加对应的引用. Xamarin.iOS项目添加引用 在Xamarin.iOS项目中,导入System.Data和Mono.Data.SQLite库的操作步骤如下: (1)打开Xamarin.iOS项目,如iOSSQLiteDemo项目

ios动态添加属性的几种方法

http://blog.csdn.net/shengyumojian/article/details/44919695 在ios运行过程中,有几种方式能够动态的添加属性. 1-通过runtime动态关联对象 主要用到了objc_setAssociatedObject,objc_getAssociatedObject以及objc_removeAssociatedObjects [objc] view plain copy //在目标target上添加关联对象,属性名propertyname(也能用

iOS viewController添加导航条以及返回跳转选择

给单独的viewcontroller或者在Appdelegate的主页面添加导航条,只要在viewcontroller上添加navigationcontroller,在添加此navigationcontroller即可 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow allo

iOS 应用添加启动画面以及App应用图标的方法

在ios开发中经常要为项目添加启动画面,目的主要有两个:一.更加美观,二.在启动画面呈现的同时加载初始化内部的项目数据. 注意在ios开发中,需要的是png格式的图片,仅仅良好的支持这一种格式,有钱就是任性. 下面介绍的都是支持在ios7及以上版本的应用: 准备工作: 1242*2208.750*1334像素的png图片主要分辨支持视网膜屏幕正常竖屏状态的5.5寸和4.7寸iPhone手机(ios8及以上系统) 2208*1242像素的png图片主要分辨支持视网膜屏幕横屏状态的5.5寸iPhon