UI第一课,iOS程序的生命周期

摘要: 一个iOS程序,从启动到显示页面,经过了一系列的事件,而这些事件有1、didFinishLaunching 完成加载2、applicationDidBecomeActive 变成活跃状态3、applicationWillResignActive 关闭活跃状态4、applicationDidEn... 阅读全文
posted @ 2014-10-20 21:40 陈丰波 阅读(117) 评论(0) 推荐(0) 编辑

存取文件

摘要: //获取Documents目录 NSString *home=NSHomeDirectory(); NSLog(@"%@",home); NSString *documents=[home stringByAppendingPathComponent:@"Documents/text.txt... 阅读全文
posted @ 2014-10-18 21:57 陈丰波 阅读(175) 评论(0) 推荐(0) 编辑

KVC的应用

摘要: // Student *stu=[[Student alloc]init];// [stu setValue:@12 forKey:@"age"];// [stu setValue:@14 forKey:@"_age"];// [stu setValue:@"zhangsan" forKey... 阅读全文
posted @ 2014-10-17 21:33 陈丰波 阅读(209) 评论(0) 推荐(0) 编辑

自定义Switch控件

摘要: MySwtch.h文件#import //@class MySwich;////@protocol MyswichDaget ////- (void)didClick:(MySwich*)sender;////@end@interface MySwich : UIView{ UIView *_xi... 阅读全文
posted @ 2014-10-16 21:27 陈丰波 阅读(179) 评论(0) 推荐(0) 编辑

数组排序

摘要: NSArray *m=[[NSArray alloc]initWithObjects:@"a",@"A",@"c",@"F",@"g", nil]; NSArray *array=[m sortedArrayUsingSelector:@selector(compare:)]; NSLog(@"... 阅读全文
posted @ 2014-10-15 21:37 陈丰波 阅读(88) 评论(0) 推荐(0) 编辑

用不可变字符串跟可变字符串做新闻网页

摘要: //不可变字符串方法 //新建一个字符串对象,将文件的内容读出来 NSString *html=[NSString stringWithContentsOfFile:@"/Users/apple/Desktop/txt1.html" encoding:NSUTF8StringEncoding ... 阅读全文
posted @ 2014-10-13 21:56 陈丰波 阅读(114) 评论(0) 推荐(0) 编辑

Nsarray跟Nsmutablearray部分方法的调用注释

摘要: Student *stu=[[Student alloc]init]; NSArray *m1=[NSArray arrayWithObjects:@"zhuangsan",@"lisi",@"wangwu", stu,nil]; //返回一个新的数组,在原数组上新加对象 NSAr... 阅读全文
posted @ 2014-10-10 21:02 陈丰波 阅读(102) 评论(0) 推荐(0) 编辑

代码创建button、view、label等控件

摘要: UIButton *b1=[[UIButton alloc]initWithFrame:CGRectMake(200, 200, 40, 20)]; b1.backgroundColor=[UIColor redColor]; view1=[[UIView alloc]initWithFrame... 阅读全文
posted @ 2014-10-09 21:15 陈丰波 阅读(268) 评论(0) 推荐(0) 编辑

类别中使用属性的两种方法

摘要: 类别因不能添加实例变量,所以添加属性不能生成实例变量也不能自动生成setter跟getter方法,但可以自己实现setter跟getter方法。第一种使用属性的方法:自己实现setter跟getter方法,用参数的值判断对主类中实例变量做一些操作。.h文件代码:#import "Fimaly.h"@... 阅读全文
posted @ 2014-10-08 21:00 陈丰波 阅读(183) 评论(0) 推荐(0) 编辑

封装、继承、多态

摘要: 封装就是把一些具体的功能的实现写在一个文件内,给外部暴露接口,调用者通过接口调用方法,实现功能,这就实现了封装。继承就是子类继承父类的所有属性跟方法,然后在新增自己的属性跟方法,叫做继承。多态是父类有的方法,子类再重载时,调用时调用子类自己的方法,或者是父类指针指向子类对象时,调用方法,如果子类有重... 阅读全文
posted @ 2014-10-05 20:41 陈丰波 阅读(123) 评论(0) 推荐(0) 编辑