摘要: 从一个视图控制器切换到另一个视图控制器的几种方式1,模态(modal)画面的显示方法:例如iphone通讯录管理程序中,追加新的通讯纪录时,就是使用这种模态画面例:点击一个按钮,进入另一个界面- (void)goForward{ ModalViewController * modalView = [[ModalViewControlleralloc]init]; modalView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; // [self presentModalViewController:modalVi... 阅读全文
posted @ 2014-01-15 20:30 ranger_cc 阅读(444) 评论(0) 推荐(0) 编辑
摘要: 1、创建空iOS项目,名称为UINavigationItem Test:2、其次,要使得程序运行时能够显示Navigation Bar:2.1 单击AppDelegate.h,向其中添加属性:@property (strong, nonatomic) UINavigationController *navController;2.2 打开AppDelegate.m,在@synthesize viewController = _viewController;之后添加代码:@synthesize navController; #pragma mark - #pragma mark Applicat 阅读全文
posted @ 2014-01-15 20:25 ranger_cc 阅读(345) 评论(0) 推荐(1) 编辑
摘要: UITableView有一个强大的编辑模式(editing mode),在编辑模式中可实现删除,插入,多选,排序等功能。使用的方法多很简单。以下介绍删除和排序功能:首先查看SDK提供的API:// Individual rows can opt out of having the -editing property set for them. If not implemented, all rows are assumed to be editable.- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSInd 阅读全文
posted @ 2014-01-15 09:48 ranger_cc 阅读(367) 评论(0) 推荐(0) 编辑
摘要: 1.通过数组NSArray的方法sortedArrayUsingComparator进行排序,该方法通过代码块方式简单易行:- (NSArray*)arraySortedByName{ NSMutableArray* InfosForSort = [NSMutableArrayarrayWithArray:oldArray]; NSArray *newArray = [InfosForSortsortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { //修改以下内容选择指定的数据作为排序的参考 IssueIn... 阅读全文
posted @ 2014-01-14 19:54 ranger_cc 阅读(596) 评论(0) 推荐(0) 编辑
摘要: 可以通过下面这个函数去掉多余的分割线。- (void)setExtraCellLineHidden: (UITableView*)tableView{ UIView*view =[ [UIViewalloc]init]; view.backgroundColor= [UIColorclearColor]; [tableViewsetTableFooterView:view]; [viewrelease];}当tableview的dataSource为空时,也就是没有数据可显示时,该方法无效,只能在numberOfRowsInsection函数,通过判断dataSouce的数据个数,如果为... 阅读全文
posted @ 2014-01-14 19:39 ranger_cc 阅读(564) 评论(0) 推荐(0) 编辑
摘要: bundle是一个目录,其中包含了程序会使用到的资源. 这些资源包含了如图像,声音,编译好的代码,nib文件(用户也会把bundle称为plug-in). 对应bundle,cocoa提供了类NSBundle.我们的程序是一个bundle. 在Finder中,一个应用程序看上去和其他文件没有什么区别. 但是实际上它是一个包含了nib文件,编译代码,以及其他资源的目录. 我们把这个目录叫做程序的main bundle。在此记录一下:在以后的开发中不直接使用任何相对路径,而是使用经过计算以后的绝对路径。常用场景如下:一.获取图片1. NSString *path = [[NSBuddle mai. 阅读全文
posted @ 2014-01-14 19:36 ranger_cc 阅读(1368) 评论(0) 推荐(0) 编辑
摘要: 今天开始使用gitlab,参照http://rogerdudler.github.io/git-guide/index.zh.html下载完OS X下的gitlab,双击图形化安装文件很轻松完成安装,之后打开终端输入which git显示git命令所在的bin目录,再输入git --version显示了一个错误:xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, use xcode-select to change使用这个命令: 阅读全文
posted @ 2014-01-13 10:30 ranger_cc 阅读(476) 评论(0) 推荐(0) 编辑
摘要: http://www.cocoachina.com/downloads/video/2010/0827/2061.html苹果开发者们想在应用中使用不同字体的话,往往会发现自己不知道 iPhone 支持什么字体、各种字体的显示效果怎么样,而且用了 UIFont fontWithName 后不知道自己的名字。下面分享一个 iPhone 支持的各种字体名称及显示效果大全。 阅读全文
posted @ 2014-01-10 18:39 ranger_cc 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 1、获取全局的Delegate对象,这样我们可以调用这个对象里的方法和变量:[(MyAppDelegate*)[[UIApplication sharedApplication] delegate] MyMethodOrMyVariable];2、获得程序的主Bundle:NSBundle *bundle = [NSBundle mainBundle];Bundle可以理解成一种文件夹,其内容遵循特定的框架。Main Bundle一种主要用途是使用程序中的资源文件,如图片、声音、plst文件等。NSURL *plistURL = [bundle URLForResource:@"pl 阅读全文
posted @ 2014-01-06 13:18 ranger_cc 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 1 协议:协议,类似于Java或C#语言中的接口,它限制了实现类必须拥有哪些方法。它是对对象行为的定义,也是对功能的规范。示例:// GoodChild.h#import @protocol GoodChild -(void)filialPiety;@end// Student.h#import #import "GoodChild.h"//注意实现协议的语法。@interface Student : NSObject@end// Student.m// protocol//// Created by sxt on 11-10-23.// Copyright 2011年 _ 阅读全文
posted @ 2014-01-06 10:37 ranger_cc 阅读(174) 评论(0) 推荐(0) 编辑