上一页 1 2 3 4 5 6 7 8 ··· 10 下一页
摘要: 介绍:Grand Central Dispatch 简称(GCD)是苹果公司开发的技术,以优化的应用程序支持多核心处理器和其他的对称多处理系统的系统。这建立在任务并行执行的线程池模式的基础上的。它首次发布在Mac OS X 10.6 ,iOS 4及以上也可用。设计:GCD的工作原理是:让程序平行排队的特定任务,根据可用的处理资源,安排他们在任何可用的处理器核心上执行任务。一个任务可以是一个函数(function)或者是一个block。GCD的底层依然是用线程实现,不过这样可以让程序员不用关注实现的细节。GCD中的FIFO队列称为dispatch queue,它可以保证先进来的任务先得到执行di 阅读全文
posted @ 2013-03-18 17:40 superchao 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 代码块本质上是和其他变量类似。不同的是,代码块存储的数据是一个函数体。使用代码块是,你可以像调用其他标准函数一样,传入参数数,并得到返回值。脱字符(^)是块的语法标记。按照我们熟悉的参数语法规约所定义的返回值以及块的主体(也就是可以执行的代码)。下图是如何把块变量赋值给一个变量的语法讲解:按照调用函数的方式调用块对象变量就可以了:int result = myBlock(4); // result是 281、参数是NSString*的代码块[cpp]view plaincopyvoid(^printBlock)(NSString*x);printBlock=^(NSString*str){NS 阅读全文
posted @ 2013-03-18 17:38 superchao 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 转:http://www.ctolive.com/space.php?uid=927&do=blog&id=2277下面收集了开发即时通讯工具,如AIM、ICQ(Oscar 协议)以及Jabber(XMPP协议)的iOS客户端程序的一些开源,可以直接使用或者参考:Oscar协议开发库LibOrange:https://github.com/unixpickle/LibOrange基于LibOrange库开啊的AIM/ICQ消息通讯工具:https://github.com/chrisballinger/Off-the-Record-iOSXMPP协议Objective-C框架: 阅读全文
posted @ 2013-02-21 14:38 superchao 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 全局变量历来就是很好的东西,能够在开发中带来很多方便,下面来介绍一下iPhone中软件开发时全局变量的使用方法:1.使用extern关键字在AppDelegate.m或AppDelegate.h中写入你需要的全局变量名,例如:int name;NSString *url;注意定义全局变量时候不能初始化,否则报错。#import @class ViewController;int name ;NSString *url;@interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window;@prop 阅读全文
posted @ 2013-01-16 10:46 superchao 阅读(249) 评论(0) 推荐(0) 编辑
摘要: cocoa框架中很多地方都使用了观察者模式一、KVOKey-Value Observing,它提供一种机制,当指定的对象的属性被修改后,则对象就会接受到通知。每次指定的被观察的对象的属性被修改后,KVO自动通知相应的观察者。model中的定义:@interface StockData : NSObject { NSString * stockName; float price;}@end@implementation StockData@endcontroller中使用,记得上一篇怎么说的吗?这里相当于跟模型说,我要收听你的更新广播- (void)viewDidLoad{ [... 阅读全文
posted @ 2013-01-07 17:24 superchao 阅读(191) 评论(0) 推荐(0) 编辑
摘要: http://www.devdiv.com/iOS_iPhone-Objective_C--%E4%BA%AB%E5%85%83%E6%A8%A1%E5%BC%8F-thread-18664-1-1.html《Objective-C编程之道 iOS设计模式解析》(英文名为Pro Objective-C Design Patterns for iOS,[美]Carlo Chung著)http://ky-storm.cn/blog/191.html#26 阅读全文
posted @ 2012-12-29 14:40 superchao 阅读(170) 评论(0) 推荐(0) 编辑
摘要: AVCaptureDevice.h主要用来获取iphone一些关于相机设备的属性。前置和后置摄像头enum{AVCaptureDevicePositionBack=1,AVCaptureDevicePositionFront =2};typedefNSIntegerAVCaptureDevicePosition;闪光灯开关enum{AVCaptureFlashModeOff=0,AVCaptureFlashModeOn =1,AVCaptureFlashModeAuto =2};typedefNSIntegerAVCaptureFlashMode;手电筒开关enum{AVCaptureTorc 阅读全文
posted @ 2012-12-27 18:07 superchao 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 首先,获取上下文CGContextRefcontext =UIGraphicsGetCurrentContext();画无框矩形//设置矩形填充颜色:红色 CGContextSetRGBFillColor(context, 1.0, 0.0, 0.0, 1.0); //填充矩形 CGContextFillRect(context, rect); //执行绘画 CGContextStrokePath(context); 画有框矩形//设置矩形填充颜色:红色 CGContextSetRGBFillColor(context, 1.0, 0.0, 0.0, 1.0); //填充矩形 ... 阅读全文
posted @ 2012-12-27 11:23 superchao 阅读(748) 评论(0) 推荐(0) 编辑
摘要: - (UIImage *)renderImageFromView:(UIView *)the_view { UIGraphicsBeginImageContextWithOptions(the_view.bounds.size, the_view.opaque, 0.0); CGContextRef context=UIGraphicsGetCurrentContext(); [the_view.layer renderInContext:context]; //取得影像 UIImage *the_image = UIGraphicsGetImageFromCurrentImageContex 阅读全文
posted @ 2012-11-08 15:49 superchao 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 在真机运行程序的时候提示“Could not launch 'app name'”,No such file or directory (/Users/apple/Library/Developer/Xcode/DerivedData/mytest-ejkagqxooxgmtdfsdoygtyzflibe/Build/Products/Debug-iphoneos/mytest.app/mytest)解决方法:先退出xcode,再把/Users/apple/Library/Developer/Xcode/DerivedData/下面的东西都删除(DerivedData本身不要删 阅读全文
posted @ 2012-10-18 17:11 superchao 阅读(291) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 10 下一页