Fork me on GitHub
上一页 1 ··· 80 81 82 83 84 85 86 87 88 ··· 125 下一页

2012年2月28日

摘要: 实例:2:使用NSOperation和NSOperationQueue启动多线程在app store中的很多应用程序非常的笨重,他们有好的界面,但操作性很差,比如说当程序从网上或本地载入数据的时候,界面被冻结了,用户只能等程序完全载入数据之后才能进行操作。当打开一个应用程序时,iphone会产生一个包含main方法的线程,所用程序中的界面都是运行在这个线程之中的(table views, tab bars, alerts…),有时候我们会用数据填充这些view,现在问 题是如何有效的载入数据,并且用户还能自如的操作程序。方法是启动新的线程,专门用于数据的下载,而主线程不会因为下载... 阅读全文
posted @ 2012-02-28 13:36 pengyingh 阅读(2378) 评论(0) 推荐(0)
摘要: NSData和结构体struct之间如何转换用处是当用NSNotification传递数据时需要这个转换,然后把NSData放到userInfo中。// make a NSData objectNSData *myData = [NSData dataWithBytes:&myPacketJoin length:sizeof(myPacketJoin)];// make a new PacketJoinPacketJoin newJoin;[myData getBytes:&newJoin length:sizeof(newJoin)];struct msg {uint32_t 阅读全文
posted @ 2012-02-28 13:21 pengyingh 阅读(2615) 评论(0) 推荐(0)
摘要: Search and Comparison OptionsThese values represent the options available to many of the string classes’ search and comparison methods.enum { NSCaseInsensitiveSearch = 1, NSLiteralSearch = 2, NSBackwardsSearch = 4, NSAnchoredSearch = 8, NSNumericSearch = 64, NSDiacriticInsensitiveSearch = 128, NSWid 阅读全文
posted @ 2012-02-28 12:57 pengyingh 阅读(915) 评论(0) 推荐(0)
摘要: NSDictionary和NSArray、NSString都是容器NSString *str=[[NSString alloc]initWithString:@"123"];含义:分配内存k,存储字符串"123",指针str指向这个内存地址;NSString *strTemp=str;含义:将指针str指向的地址传递给指针strTemp两个指针str、strTemp指向同一个地址KNSArray *arr=[[NSArray alloc]initWithObject:strTemp];[arr objectAtIndex:0]也是指针,也指向地址K情况1 阅读全文
posted @ 2012-02-28 12:49 pengyingh 阅读(118) 评论(0) 推荐(0)
摘要: libxml的attributes参数用结构体表示static void startElementSAX (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_de... 阅读全文
posted @ 2012-02-28 11:25 pengyingh 阅读(439) 评论(0) 推荐(0)

2012年2月26日

摘要: NSData *_data;NSData *_lastData;@property(retain)NSData *data;@property(retain)NSData *lastData;当self.lastData=[_data copy];_lastData 的引用计数加1;当_lastData=[_data copy];_lastData 的引用计数不变;当_lastData=[self.data copy];时候_Data的引用计数加1当_lastData=[_data copy];时候_Data的引用计数不变;NSData引用计数不管增加多少,只要最后 data=nil;引用计. 阅读全文
posted @ 2012-02-26 09:02 pengyingh 阅读(256) 评论(0) 推荐(0)

2012年2月25日

摘要: 作用:NSNotificationCenter是专门供程序中不同类间的消息通信而设置的.注册通知:即要在什么地方接受消息[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(mytest:)name:@" mytest"object:nil];参数介绍:addObserver: 观察者,即在什么地方接收通知; selector: 收到通知后调用何种方法; name: 通知的名字,也是通知的唯一标示,编译器就通过这个找到通知的。发送通知:调用观察者处的方法。[[NSNotification 阅读全文
posted @ 2012-02-25 00:58 pengyingh 阅读(49627) 评论(1) 推荐(8)

2012年2月24日

摘要: 工程TARGET~ BuildPhrase~ LinkBinaryWithLibraries 加入 : libxml2.2.dylib工程TARGET ~BuildSetting~搜索框中输入: Header Search Path 输入路径 : ${SDKROOT}/usr/include/libxml2.h 头文件: 加入 : import<libxml/tree.h>点开头文件,查看内容: typedef struct _xmlSAXHandler xmlSAXHandler;点开 _xmlSAXHandler ,查看内容 ... 阅读全文
posted @ 2012-02-24 21:36 pengyingh 阅读(581) 评论(0) 推荐(1)
摘要: objectforkey 是NSDictionary的方法,valueforkey 是KVC的方法, 两者都是键值对应,区别是valueforkey 只允许使用NSString类型,objectforkey可以是任意类型. objectForKey:is anNSDictionarymethod. AnNSDictionaryis a collection class similar to anNSArray, except instead of using indexes, it uses keys to differentiate between items. A key is an ar 阅读全文
posted @ 2012-02-24 10:38 pengyingh 阅读(4949) 评论(0) 推荐(0)

2012年2月23日

摘要: OK, I found in the code sample from Apple, man use the NSAssert3, so I think I really need to google the meaning of NSAssertX, because somewhere man use NSAssert1, somewhere man use the NSAssert3, or others, So I find the explain for that from the page:http://gnu.ethz.ch/debian/gnustep-base/gnustep- 阅读全文
posted @ 2012-02-23 16:06 pengyingh 阅读(1231) 评论(0) 推荐(0)
上一页 1 ··· 80 81 82 83 84 85 86 87 88 ··· 125 下一页

导航