对象
文章平均质量分 65
yuanyinhua
这个作者很懒,什么都没留下…
展开
-
optional(对象与实例)
//对象/实例 var ani1: Animal = Animal() ani1.weight =10 ani1.age =1 ani1.eat() println("\(ani1.weight)")原创 2014-06-12 21:17:46 · 2984 阅读 · 0 评论 -
NSString的一些常用方法
NSString 方法名名词开头的不会改变当前对象的内容,动词开头会改变对象的内容 把字符串str通过字符集(/;’)分割 NSString *str = @"aaaa/a/a;s;d’sd.exe";NSArray *arr = [str componentsSeparatedByCharactersInSet: [NSCharacterSet characterSetWithCh原创 2014-08-16 14:32:11 · 403 阅读 · 0 评论 -
block代替协议自定义UIScrollView实现分页效果
#import @interface CustomScrollView : UIView@property (nonatomic, strong) NSInteger (^numberOfPageInScrollView)(CustomScrollView*);@property (nonatomic, strong) UIView *(^scroll)(CustomScrollView原创 2014-08-20 21:35:36 · 446 阅读 · 0 评论 -
UITabBarController
只有被装在该数组的视图控制器才能够在运行的时候移动位置 tabBarCtrl.customizableViewControllers = @[viewCtrl6, viewCtrl3]; viewCtrl.tabBarItem.badgeValue = nil;//@"新消息"; tabBarCtrl.tabBar.translucent = NO;//半透明hi原创 2014-08-18 22:14:55 · 529 阅读 · 0 评论 -
NSArray/NSMutableArray
EndIt *end0 = [[EndIt alloc] init]; EndIt *end1 = [[EndIt alloc] init]; EndIt *end2 = [[EndIt alloc] init]; EndIt *end3 = [[EndIt alloc] init]; EndIt *end4 = [[EndIt alloc] init];原创 2014-07-31 21:05:59 · 425 阅读 · 0 评论 -
NSURLConnection
//同步方法发送请求并获取返回数据 NSURLResponse *response = [[NSURLResponse alloc]init]; NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil]; NSLog(@"%原创 2014-08-08 19:17:39 · 328 阅读 · 0 评论 -
NSKeyedArchiver/NSKeyedUnarchiver归档解归档的使用
原创 2014-07-30 22:55:06 · 561 阅读 · 0 评论 -
对象的拷贝(NSCopying/NSMutableCopying)
①Shallow 浅拷贝 Deep 深拷贝Shallow值复制对象本身,而不会复制对象引用的其他对象Deep复制对象本身还有对象所引用的其它对象Foundation框架里支持拷贝的类,默认是Shallow②对于系统的类,copy返回的是一个不可变对象(复制的对象是可变对象也一样),MutableCop返回可变对象Shallow和Deep的区别就是Deep需要实现copyWithZon原创 2014-07-29 17:49:44 · 410 阅读 · 0 评论 -
按钮,图片,瑞士国旗的升降,手势
//// ViewController.m// OCGuoQi//// Created by apple on 14-7-8.// Copyright (c) 2014年 apple . All rights reserved.//#import "ViewController.h"@interface ViewController (){ UIView *redView; UIButton *b原创 2014-07-10 09:19:36 · 754 阅读 · 0 评论 -
修改声明为const的变量的值
#include #include usingnamespace std;intmain(void){ inttemp = 4; //non use volatile std::cout <<"non use volatile:" const int a = 1; void*pa = (void *原创 2014-07-08 18:42:15 · 512 阅读 · 0 评论 -
默认初始化方法的过程
创建一个类的对象时,一定要调用它们的默认初始化器或者指定的初始化器进行初始化具体:创建一个 Monkey 继承自NSObject 的类,定义3个实例变量#import @interface Monkey : NSObject- (id)initWithWeight: (int)weight;- (id)initWithWeight:(int)weight height:(int)he原创 2014-08-13 22:36:12 · 470 阅读 · 0 评论