上一页 1 ··· 5 6 7 8 9 10 11 下一页
摘要: 方法重载要保证三个条件1在同一个类中2.方法参数类型相同 名称相同3.方法的参数不同请看下面的例子@interface whgMyObject : NSObject-(void)print;-(void)print:(int)a;-(void)print:(int)a and:(int)b; @end@implementation whgMyObject-(void)print{ NSLog(@"看着月亮一起笑");}-(void)print:(int)a{ NSLog(@"老的不行不行还拥抱");}-(void)print:(int)a and:(in 阅读全文
posted @ 2013-07-25 15:45 火红的云彩 阅读(636) 评论(2) 推荐(0) 编辑
摘要: xcode新建项目介绍 1.打开xcode选择“create a new xcode project 2.product name 工程名称 campany identifter 公司id 一般都写公司的网站域名 列入:www.baidu.com 这块就把它到着写 baidu.com bundle identifier 标签编号 3.点下一步就ok了 阅读全文
posted @ 2013-07-21 10:47 火红的云彩 阅读(387) 评论(0) 推荐(0) 编辑
摘要: 结构 在oc中只能声明变量 不能声明函数和类结构声明struct DateT {int month;int day;int year;};结构可以在起最后的分号之后定义结构变量,并且可以格式化structDateT {intmonth;intday;intyear;}today{1,2,3};结构可以不定义名字 ,但是要先声明变量struct {intmonth;intday;intyear;}today{1,2,3};结构可以嵌套structDateT {intmonth;intday;intyear;};struct Time {int hoursint seconds;int min;} 阅读全文
posted @ 2013-07-19 10:01 火红的云彩 阅读(590) 评论(0) 推荐(0) 编辑
摘要: ios中的分类其实就是把两个类用两个或多个文件写的,,在平时的开发中我们会发现有的时候我们想要一个类多个什么功能 但是已经定义好的类中没有,,我们又不想更改我们的程序 那么现在的这种情况下我就可以用分类下面是我写的一个关于把行同种的nsarray的类 添加了一个print功能 下面是代码#import @interface NSArray (print) //定义分类的格式-(void)print;@end@implementation NSArray (print)-(void)print //自定义的打印输出功能{ for (NSString* m in self) { NSLo... 阅读全文
posted @ 2013-07-18 21:19 火红的云彩 阅读(365) 评论(0) 推荐(1) 编辑
摘要: ios中的协议:大家猛一看 感觉挺高深的 其实ios中的协议就是c#,java中的接口 只是变了一个形式;自我感觉ios中的协议没有c#中的接口好 人家的接口就是固定你的程序内容的 而ios中的协议和类就有点冲突了下面写一协议 请看下面的程序先生名个propcle的协议 在声明个pro的类继承这个协议 然后通过主函数调用#import @protocol Prorocol @required //它下面定义必须要的函数 就是说pro类中必须实现的函数 如果步实现 编译器就会报错的 -(void)print;@optional //他下面定义可有的 就算pro类中不实现这个函数也不会报错-(.. 阅读全文
posted @ 2013-07-18 20:49 火红的云彩 阅读(468) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 下一页