六:获得另一个控件器,并实现跳转

UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

UIViewController *registerViewController = [mainStoryboard instantiateViewControllerWithIdentifier:@"registerViewController"];

registerViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

[self presentViewController:registerViewController animated:YES completion:^{

NSLog(@"Present Modal View");

}];

另一种用segue连接:

如果在storyboard中当前的ViewController和要跳转的ViewController之间的segue之间存在,则可以执行performSegueWithIdentifier:sender:这个方法实现跳转。

  比如:[self performSegueWithIdentifier:@"go" sender:self];

     其中,go为自己定义的segue标识符。

其中registerViewController是第二个视图中标识检查器Storyboard ID的值

七:判断IOS版本

判断IOS是不是7.0以后的

if([[[UIDevice currentDevice] systemVersion] floatValue]>=7.0) {

}

八:Button不同状态下背景图片

[_registerButton setBackgroundImage:[UIImage imageNamed:@"3signbutton-n.png"] forState:UIControlStateNormal];

[_registerButton setBackgroundImage:[UIImage imageNamed:@"3signbutton-s.png"] forState:UIControlStateHighlighted];

九:判断设备是3.5寸还是4寸

if ([[UIScreen mainScreen] currentMode].size.height == 480||[[UIScreenmainScreen] currentMode].size.height == 960)

{

//这是3.5寸的iPhone设备

}

else

{     //这是4寸的iPhone设备 }

十:viewDidLoad中调用

无论你是通过xib文件还是重写loadView方法创建UIViewController的view,在view创建完毕后,最终都会调用viewDidLoad方法,一般我们会在这里做界面上的初始化操作,比如往view中添加一些子视图、从数据库或者网络加载模型数据装配到子视图中

- (void)viewDidLoad
{
[super viewDidLoad]; // 添加一个按钮
UIButton *button = [UIButton buttonWithType:UIButtonTypeContactAdd];
[button addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
}

十一:树形结构导航问题(UINavigationController)

1:如何修改第二页的返回back文字

应该在第一页的viewDidLoad里面进行修改(假设从A界面push到B界面,希望改变B界面的返回按钮标题,则在A界面中加入代码),代码如下:

-(void)viewDidLoad
{
UIBarButtonItem *backItem = [[[UIBarButtonItem alloc] init] autorelease]; backItem.title = @"返回"; self.navigationItem.backBarButtonItem = backItem;
}

2:如何增加一个控件在标头

在本页的viewDidLoad里面进行增加;代码如下:

-(void)viewDidLoad
{
UIBarButtonItem* Done=[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(DownShow)];
self.navigationItem.rightBarButtonItem=Done;
} -(void)DownShow
{ }

其中按键类型如下(带有不同的图标):

    UIBarButtonSystemItemDone,
UIBarButtonSystemItemCancel,
UIBarButtonSystemItemEdit,
UIBarButtonSystemItemSave,
UIBarButtonSystemItemAdd,
UIBarButtonSystemItemFlexibleSpace,
UIBarButtonSystemItemFixedSpace,
UIBarButtonSystemItemCompose,
UIBarButtonSystemItemReply,
UIBarButtonSystemItemAction,
UIBarButtonSystemItemOrganize,
UIBarButtonSystemItemBookmarks,
UIBarButtonSystemItemSearch,
UIBarButtonSystemItemRefresh,
UIBarButtonSystemItemStop,
UIBarButtonSystemItemCamera,
UIBarButtonSystemItemTrash,
UIBarButtonSystemItemPlay,
UIBarButtonSystemItemPause,
UIBarButtonSystemItemRewind,
UIBarButtonSystemItemFastForward,
UIBarButtonSystemItemUndo,
UIBarButtonSystemItemRedo,
UIBarButtonSystemItemPageCurl//只能在ToolBar上显示

3:如何修改标头的色彩

self.navigationController.navigationBar.tintColor=[UIColor redColor];

4:增加其它UISegment,UISwith控件

在本页viewDidLoad中增加如下代码,

    UISegmentedControl *mySegment;

    mySegment = [[UISegmentedControl alloc] initWithFrame:CGRectMake(218.0f, 8.0, 100.0f, 30.0f)];

    [mySegment insertSegmentWithTitle:@"分配" atIndex: animated:YES];

    [mySegment insertSegmentWithTitle:@"处理" atIndex: animated:YES];

    mySegment.segmentedControlStyle = UISegmentedControlStyleBar;

    mySegment.selectedSegmentIndex = ;

    [self.navigationController.navigationBar addSubview:mySegment];

IOS开发基础知识--碎片2的更多相关文章

  1. IOS开发基础知识碎片-导航

    1:IOS开发基础知识--碎片1 a:NSString与NSInteger的互换 b:Objective-c中集合里面不能存放基础类型,比如int string float等,只能把它们转化成对象才可 ...

  2. IOS开发基础知识--碎片33

    1:AFNetworking状态栏网络请求效果 直接在AppDelegate里面didFinishLaunchingWithOptions进行设置 [[AFNetworkActivityIndicat ...

  3. IOS开发基础知识--碎片42

    1:报thread 1:exc_bad_access(code=1,address=0x70********) 闪退 这种错误通常是内存管理的问题,一般是访问了已经释放的对象导致的,可以开启僵尸对象( ...

  4. IOS开发基础知识--碎片50

      1:Masonry 2个或2个以上的控件等间隔排序 /** * 多个控件固定间隔的等间隔排列,变化的是控件的长度或者宽度值 * * @param axisType 轴线方向 * @param fi ...

  5. IOS开发基础知识--碎片3

    十二:判断设备 //设备名称 return [UIDevice currentDevice].name; //设备型号,只可得到是何设备,无法得到是第几代设备 return [UIDevice cur ...

  6. IOS开发基础知识--碎片11

    1:AFNetwork判断网络状态 #import “AFNetworkActivityIndicatorManager.h" - (BOOL)application:(UIApplicat ...

  7. IOS开发基础知识--碎片14

    1:ZIP文件压缩跟解压,使用ZipArchive 创建/添加一个zip包 ZipArchive* zipFile = [[ZipArchive alloc] init]; //次数得zipfilen ...

  8. IOS开发基础知识--碎片16

    1:Objective-C语法之动态类型(isKindOfClass, isMemberOfClass,id) 对象在运行时获取其类型的能力称为内省.内省可以有多种方法实现. 判断对象类型 -(BOO ...

  9. IOS开发基础知识--碎片19

    1:键盘事件顺序 UIKeyboardWillShowNotification // 键盘显示之前 UIKeyboardDidShowNotification // 键盘显示完成后 UIKeyboar ...

  10. IOS开发基础知识--碎片40

    1:Masonry快速查看报错小技巧 self.statusLabel = [UILabel new]; [self.contentView addSubview:self.statusLabel]; ...

随机推荐

  1. 分享个刚写好的 android 的 ListView 动态加载类,功能全而代码少。

    (转载声明出处:http://www.cnblogs.com/linguanh/) 简介:      该ListView 实现动态加载数据,为了方便用户充分地自定义自己的数据源.点击事件,等核心操作, ...

  2. android 真机调试出现错误 INSTALL_FAILED_INSUFFICIENT_STORAGE 的解决方法。

    关于这个神奇的 内存不够错误的通常解决方法,网上大把,建议大家在尝试过了网上的方法后再来尝试下我的这种方法. 编译工具: android studio 测试真机:米 2 调试的时候出现:INSTALL ...

  3. 【SQLServer】DBHelper即C#数据库底层封装

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.C ...

  4. android 官方DrawerLayout的介绍和使用

    南尘:爱编程,爱安卓,每天进步一点点. drawerLayout是Support Library包中实现了侧滑菜单效果的控件,可以说drawerLayout是因为第三方控件如MenuDrawer等的出 ...

  5. JsTree实现简单的CRUD

    现在需要将省市县区域这块搞成树状图的形状,由于项目使用的AngularJS+ABP+WebAPI各个模块之间数据传输形式是json格式,那么对于JsTree来说就方便很多了,只需要将json数据搞成我 ...

  6. 悟透JavaScript

    要理解JavaScript,你得首先放下对象和类的概念,回到数据和代码的本原.前面说过,编程世界只有数据和代码两种基本元素,而这两种元素又有着纠缠不清的关系.JavaScript就是把数据和代码都简化 ...

  7. Rafy 领域实体框架示例(1) - 转换传统三层应用程序

    Rafy 领域实体框架发布后,虽然有帮助文档,许多朋友还是反映学习起来比较复杂,希望能开发一个示例程序,展示如何使用 Rafy 领域实体框架所以,本文通过使用 Rafy 领域实体框架来改造一个传统的三 ...

  8. Chrome立体动画代码

    效果预览:http://hovertree.com/code/run/css/x8l6si70.html 请实用Chrome浏览器查看效果,手机上也可以. 代码如下: <!DOCTYPE htm ...

  9. 关于大数据企业信息查询的API该怎么写

    最近在看API相关的案例,做的是.net开发的工作 对API开发这块很是迷茫,不知道从哪入手,园子里面的朋友有没有研究这块的给点建议 公司目前准备做一款企业数据查询的网站,让我负责API接口这块,基于 ...

  10. 【配置属性】—Entity Framework 对应表字段的类型的设定配置方法

    摘自:http://www.cnblogs.com/nianming/archive/2012/11/07/2757997.html Entity Framework Code First的默认行为是 ...