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

2012年5月13日

摘要: origion:http://www.alterplay.com/ios-dev-tips/2009/10/asynchronous-uiimage.htmlEverybody needed or will need to load images from web. The easiest way to do it is to get NSData from NSURL and create UIImage:UIImage *myImage = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithS 阅读全文
posted @ 2012-05-13 23:43 pengyingh 阅读(357) 评论(0) 推荐(0)
摘要: A good example for using allocWithZone: is when you are implementing the NSCopy protocol, which allows you make your custom objects copyable (deep copy / copy by value) like: ClassName *newObject = [currentObject copy]; //results in newObject being a copy of currentObject not just a reference to itT 阅读全文
posted @ 2012-05-13 23:08 pengyingh 阅读(454) 评论(0) 推荐(0)

2012年5月11日

摘要: 原文:http://www.duckrowing.com/2010/05/21/using-the-singleton-pattern-in-objective-c/感谢作者what the purpose of the +allocWithZone override is?+allocWithZone is overridden to make sure you can only allocate a single instance of this object. All subsequent calls should return nil.I don't think you' 阅读全文
posted @ 2012-05-11 16:03 pengyingh 阅读(564) 评论(0) 推荐(0)
摘要: http://gaoyong.diandian.com/post/2011-11-02/6443926我们今天谈谈cocoa程序设计中的模型-视图-控制器(MVC)范型。我们将从两大方面来讨论MVC:什么是MVC?M、V、C之间的交流方式是什么样子的?理解了MVC的概念,对cocoa程序开发是至关重要的。一、MVC的概念MVC是Model-VIew-Controller,就是模型-视图-控制器,这些都是什么东西呢?MVC把软件系统分为三个部分:Model,View,Controller。在cocoa中,你的程序中的每一个object(对象)都将明显地仅属于这三部分中的一个,而完全不属于另外两个 阅读全文
posted @ 2012-05-11 09:03 pengyingh 阅读(14096) 评论(4) 推荐(1)

2012年5月10日

摘要: http://southking.iteye.com/blog/1489462假设两个ViewController之间已经建立了SegueA:TableViewController的子类 B:viewController A --> B 传送数据类Player的对象player1.设置Segue的identifier2.在B.h里添加Java代码@property(nonatomic,strong)Player*player; 在B.m里添加Java代码@synthesizeplayer;3.在A.m里重写UIViewController 的以下方法Java代码-(void)prepar 阅读全文
posted @ 2012-05-10 19:22 pengyingh 阅读(569) 评论(0) 推荐(0)
摘要: http://southking.iteye.com/blog/1487806ARC是什么ARC是iOS 5推出的新功能,全称叫 ARC(Automatic Reference Counting)。简单地说,就是代码中自动加入了retain/release,原先需要手动添加的用来处理内存管理的引用计数的代码可以自动地由编译器完成了。该机能在 iOS 5/ Mac OS X 10.7 开始导入,利用 Xcode4.2 可以使用该机能。简单地理解ARC,就是通过指定的语法,让编译器(LLVM 3.0)在编译代码时,自动生成实例的引用计数管理部分代码。有一点,ARC并不是GC,它只是一种代码静态分析 阅读全文
posted @ 2012-05-10 19:17 pengyingh 阅读(1293) 评论(0) 推荐(0)
摘要: 前两节我们对 ARC(Automatic Reference Counting) 有了一个基本的理解,但是 ARC 是怎么产生的,为什么苹果要在其最新的 iOS/Mac OS X 上导入该框架? 如果不理解其背后的基本原理,只是死记硬背那些规则/方法,是毫无意义的。就像我们从小接受的填鸭式教育,基本上到后来都还给老师了。本节,我们先来看看 ARC 产生之前的 Objective-C 内存管理世界,然后再来看看导入 ARC 后,新的 LLVM 编译器在背后为我们做了什么。Objective-C 内存管理和许多面向对象语言一样,Objective-C 中内存管理的方式其实就是指引用计数(Refer 阅读全文
posted @ 2012-05-10 18:56 pengyingh 阅读(212) 评论(0) 推荐(0)
摘要: NSArray *allObject = [dictionary allValues];[allObject makeObjectsPerformSelector:@selector(objSel)]; 阅读全文
posted @ 2012-05-10 18:06 pengyingh 阅读(162) 评论(0) 推荐(0)
摘要: Stream是单向的,Reading From Input Streams:1.Create and initilize an instance of NSInputStream from s source of data;2.Sechedule the stream object on a run loop and open the stream;3.Handle the events that the stream object reports to its delegate;4.When there is no data to read,dispose the stream object 阅读全文
posted @ 2012-05-10 17:57 pengyingh 阅读(180) 评论(0) 推荐(0)
摘要: http://www.cnblogs.com/wustlj/archive/2011/12/20/2294745.html所有的引用计数系统,都存在循环应用的问题。例如下面的引用关系:对象a创建并引用到了对象b.对象b创建并引用到了对象c.对象c创建并引用到了对象b.这时候b和c的引用计数分别是2和1。当a不再使用b,调用release释放对b的所有权,因为c还引用了b,所以b的引用计数为1,b不会被释放。b不释放,c的引用计数就是1,c也不会被释放。从此,b和c永远留在内存中。这种情况,必须打断循环引用,通过其他规则来维护引用关系。比如,我们常见的delegate往往是assign方式的属性 阅读全文
posted @ 2012-05-10 17:37 pengyingh 阅读(2983) 评论(0) 推荐(0)
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 125 下一页

导航