Fork me on GitHub
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 125 下一页

2012年5月10日

摘要: http://southking.iteye.com/blog/1487811概念当我们使用强参照(Strong reference)时,往往需要留意循环参照的问题。循环参照指的是两个对象被互相强参照,以至于任一对象都不能释放。一般情况下,当对象之间有“父子关系”时,强参照的情况发生的比较多。比如通讯薄对象AddrBook和每个通讯录Entry的关系如下。这种情况下,由于Entry对象被AddrBook强参照,所以不能释放。另一方面,如果Entry被释放了,AddrBook对象的强参照也就没有了,其对象也应被释放。解决方式像上面的例子,当多个对象间有“父子关系”时,需要在一侧用“弱参照”来解决 阅读全文
posted @ 2012-05-10 17:22 pengyingh 阅读(316) 评论(0) 推荐(0)
摘要: http://southking.iteye.com/blog/1487814自 Xcode4.2 开始导入ARC机制后,为了支持对象间的转型,Apple又增加了许多转型用的关键字。这一讲我们就来了解其用法,以及产生的理由。引子我们先来看一下ARC无效的时候,我们写id类型转void*类型的写法:12id obj = [[NSObject alloc] init];void *p = obj;反过来,当把void*对象变回id类型时,只是简单地如下来写,12id obj = p;[obj release];但是上面的代码在ARC有效时,就有了下面的错误: error: implicit ... 阅读全文
posted @ 2012-05-10 16:30 pengyingh 阅读(183) 评论(0) 推荐(0)
摘要: Both detachNewThreadSelector and performSelectorInBackground are used to call a method in the background.Is there any difference between the 2 methods? or do they both work the same way?answer:They're both essentially the same but slightly different paradigms. Behind the scenes they do exactly t 阅读全文
posted @ 2012-05-10 16:10 pengyingh 阅读(562) 评论(0) 推荐(0)
摘要: http://blog.sina.com.cn/s/blog_9030ba4b01012db1.html简介:CAEmitterLayer提供了一个基于Core Animation的粒子发射系统,粒子用CAEmitterCell来初始化。粒子画在背景层盒边界上Properties:birthRate:粒子产生系数,默认1.0;emitterCells:装着CAEmitterCell对象的数组,被用于把粒子投放到layer上;emitterDepth:决定粒子形状的深度联系:emitter shapeemitterMode:发射模式NSString * const kCAEmitterLayer 阅读全文
posted @ 2012-05-10 16:08 pengyingh 阅读(328) 评论(0) 推荐(0)
摘要: http://www.x2x1.com/show/9787537.aspxHow can I calculate points around a sphere? I need this for my particles explosion. I don't want the particle's points to be all random. I need them in a spherical pattern. For 2d circle explosion I was using this:float n=many;float rad = 1;for (int i = 0 阅读全文
posted @ 2012-05-10 15:56 pengyingh 阅读(220) 评论(0) 推荐(0)
摘要: uiview类每次nib加载的时候,更新此方法,区别,viewDidLoad方法只执行一次,此方法每次切换到视图都会加载,类似uiviewController的 - (void)viewWillAppear:(BOOL)animated; 方法- (void)awakeFromNib当IB加载的时候, 界面的补充初始化用这个. 阅读全文
posted @ 2012-05-10 12:20 pengyingh 阅读(350) 评论(0) 推荐(0)
摘要: 1.TARGETS --->build settings 搜索 compiler 找到 compiler for c/c++/objective-c 改成 APPLE LLVM compiler 3.02.TARGETS --->build settings 搜索 analyzer Run Static Analyzer 改成 YES3.TARGETS --->build settings 搜索 automatic objective-c Automatic Reference Counting 改成YES4.From Xcode's m... 阅读全文
posted @ 2012-05-10 09:32 pengyingh 阅读(379) 评论(0) 推荐(0)

2012年5月9日

摘要: #define TEXT_INPUT_NUMBERS @"0123456789"- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ if(textField == _textInput){ if(range.location >= 11){ return NO; } NSCharacterSet *cs; cs = [[NSCharacterSet cha... 阅读全文
posted @ 2012-05-09 12:39 pengyingh 阅读(321) 评论(0) 推荐(0)
摘要: enum { noErr = 0};enum { kNilOptions = 0};#define kInvalidID 0enum { kVariableLengthArray = 1};enum { kUnknownType = 0x3F3F3F3F/* "????" QuickTime 3.0: default unknown ResType or OSType */}; 阅读全文
posted @ 2012-05-09 09:27 pengyingh 阅读(601) 评论(0) 推荐(0)

2012年5月8日

摘要: http://stackoverflow.com/questions/2003201/observing-pinch-multi-touch-gestures-in-a-uitableviewI am looking to implement a pinch in/out on top of a UITableView, I have looked at several methods including this one:But while I can create aUIViewTouchobject and overlay it onto my UITableView, scroll e 阅读全文
posted @ 2012-05-08 16:46 pengyingh 阅读(553) 评论(0) 推荐(0)
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 125 下一页

导航