03 2014 档案

receiver type *** for instance message is a forward declaration
摘要:转自:http://stackoverflow.com/questions/8815200/receiver-type-for-instance-message-is-a-forward-declarationYou're -init'ing an object without +alloc'ing it. That won't workYou're declaring an object as a non-pointer type, that won't work eitherYou're not calling [super init 阅读全文

posted @ 2014-03-28 16:00 王培 阅读(523) 评论(0) 推荐(0) 编辑

copy 的实现原理与深浅拷贝
摘要:转自:http://bbs.9ria.com/thread-210322-1-1.html首先,从copy开始说,简而言之,copy的目的就是生成一个新的实例,然后把其成员都按原实例赋值。对于非指针型的成员,比如BOOL, int, float,这样的赋值可以直接进行。但是对于指针型的数据,比如Objc中用到的对象,就有Deep Copy和Shallow Copy的区别——这个和在C++中的基本上是一样的:是生成新的成员对象,或是指向同一成员对象。了解了这点以后,再看看Copy在 Objetive-C中的实现方式。如果要调用一个对象的copy方法,这个对象必须遵循NSCopying的协议。这个 阅读全文

posted @ 2014-03-26 10:49 王培 阅读(447) 评论(0) 推荐(0) 编辑

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 王培 阅读(353) 评论(0) 推荐(0) 编辑

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 王培 阅读(238) 评论(0) 推荐(0) 编辑

关于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 王培 阅读(240) 评论(0) 推荐(0) 编辑

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 王培 阅读(520) 评论(0) 推荐(0) 编辑

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 王培 阅读(213) 评论(0) 推荐(0) 编辑

[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 王培 阅读(186) 评论(0) 推荐(0) 编辑

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 王培 阅读(480) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示