上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 64 下一页

2014年3月24日

Avoid strong reference cycles

摘要: 转自:http://masteringios.com/blog/2014/03/06/avoid-strong-reference-cycles/With the introduction of ARC, memory management became easier. However, even though you don’t have to worry about when to retain and release, there are still a few rules you need to know in order to avoid memory problems. In th 阅读全文

posted @ 2014-03-24 16:13 王培 阅读(349) 评论(0) 推荐(0) 编辑

2014年3月20日

NSArray的排序方法

摘要: 转自:http://blog.csdn.net/lixuwen521/article/details/78488931.sortedArrayUsingSelector(按Key值大小对NSDictionary排序)[plain]view plaincopyNSMutableArray*array=[NSMutableArrayarrayWithObjects:[NSDictionarydictionaryWithObjectsAndKeys:@"Obj0",[NSNumbernumberWithInt:0],nil],[NSDictionarydictionaryWith 阅读全文

posted @ 2014-03-20 16:08 王培 阅读(233) 评论(0) 推荐(0) 编辑

2014年3月19日

关于CGContextSetBlendMode: invalid context 0x0的错误

摘要: 转自:http://www.cnblogs.com/leipei2352/p/3496058.html在ios 7的模拟器中,选择一个输入框准备输入时,会触发这个错误,以下是出错详细日志:: CGContextSetBlendMode: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system sta 阅读全文

posted @ 2014-03-19 12:02 王培 阅读(236) 评论(0) 推荐(0) 编辑

2014年3月18日

IOS 获取设备屏幕的尺寸

摘要: // 不包含状态栏CGRect rect1 = [UIScreen mainScreen].applicationFrame;// 包含状态栏(整个屏幕)CGRect rect2 = [[UIScreen mainScreen] bounds];CGSize size = rect.size;CGFloat width = size.width;CGFloat height = size.height; 阅读全文

posted @ 2014-03-18 16:41 王培 阅读(516) 评论(0) 推荐(0) 编辑

2014年3月17日

iOS中控件的Frame属性和Bounds属性的区别

摘要: 转自:http://www.cnblogs.com/wisejoker/p/3574889.html在iOS中,每个控件都是继承于UIView的,都会有视图的属性存在,控制这个视图的位置就有Frame和Bounds两个属性frame指的是:该view在父view坐标系统中的位置和大小。(参照点是父亲的坐标系统)其中的坐标是我的左上角坐标相对于我的父视图左上角的坐标。如果我修改坐标,x+50,y+50,那么我就会相对于我的父视图移动,相对于父视图,我向右移动50,向下移动50bounds指的是:该view在本身坐标系统中的位置和大小。(参照点是本身坐标系统)其中的坐标是我的子视图左上角的坐标相对 阅读全文

posted @ 2014-03-17 17:09 王培 阅读(209) 评论(0) 推荐(0) 编辑

2014年3月7日

[Objective-C]关联(objc_setAssociatedObject、objc_getAssociatedObject、objc_removeAssociatedObjects)

摘要: 转自:http://blog.csdn.net/onlyou930/article/details/9299169关联 关联是指把两个对象相互关联起来,使得其中的一个对象作为另外一个对象的一部分。 关联特性只有在Mac OS X V10.6以及以后的版本上才是可用的。在类的定义之外为类增加额外的存储空间 使用关联,我们可以不用修改类的定义而为其对象增加存储空间。这在我们无法访问到类的源码的时候或者是考虑到二进制兼容性的时候是非常有用。 关联是基于关键字的,因此,我们可以为任何对象增加任意多的关联,每个都使用不同的关键字即可。关联是可以保证被关联的对象在关联对象的整个生命周期都是可用的(... 阅读全文

posted @ 2014-03-07 15:16 王培 阅读(182) 评论(0) 推荐(0) 编辑

2014年3月4日

DB2检测表字段改动的方法(不用触发器)

摘要: ALTER TABLE TEST ADD COLUMNRTS TIMESTAMP NOT NULLGENERATED ALWAYSFOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMPIMPLICITLY HIDDEN 阅读全文

posted @ 2014-03-04 16:07 王培 阅读(471) 评论(0) 推荐(0) 编辑

2014年2月26日

关于release后retainCount还是1的问题

摘要: 转自:http://www.cocoachina.com/bbs/read.php?tid=175523realse之后再调用还能调用的的问题,我做了这么多年也是经常遇到,也曾经试图寻找原因,就像6楼说的,很多时候都会出现realse过后还能调用的现象。而且对象不是autorealse的。我还遇到过奇葩的是,每次要等上好几秒钟再调用才会出现空指针异常。(代码里绝对没有手动多线程)还有很多时候跟你测试的硬件环境还有关,可以说,ios的内存管理策略虽然一如既往的是一套,但是每个版本都有细微的变化,使用中还是能感觉出来,只是没有官方的说明,无法正确的解释。不过随着一些界面业务该用autoreleas 阅读全文

posted @ 2014-02-26 14:04 王培 阅读(506) 评论(0) 推荐(0) 编辑

(oneway void) release中oneway的意思

摘要: oneway is used with the distributed objects API, which allows use of objective-c objects between different threads or applications. It tells the system that it should not block the calling thread until the method returns. Without it, the caller will block, even though the method's return type is 阅读全文

posted @ 2014-02-26 13:10 王培 阅读(485) 评论(0) 推荐(0) 编辑

Objective-C的内存管理(一)黄金法则的理解

摘要: 转自:http://blog.csdn.net/lonelyroamer/article/details/7666851一、内存管理黄金法则:The basic rule to apple is everything thatincreases the reference counter with alloc,[mutable]copy[WithZone:] or retainis in charge of the corresponding [auto]release.如果一个对象使用了alloc,[mutable] copy,retain,那么你必须使用相应的release或autonre 阅读全文

posted @ 2014-02-26 11:41 王培 阅读(316) 评论(0) 推荐(0) 编辑

上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 64 下一页

导航