Fork me on GitHub

2012年5月4日

摘要: - (void)saveImageWithData:(NSData*)jpeg andDictionary:(NSDictionary*)dicRef andName:(NSString*)name{ [self setCapturedImageName:name]; CGImageSourceRef source ; // Notice here how I use __bridge source = CGImageSourceCreateWithData((__bridge CFDataRef)jpeg, NULL); CFStringRef UTI = C... 阅读全文
posted @ 2012-05-04 15:52 pengyingh 阅读(965) 评论(0) 推荐(0)
摘要: ask:I am trying to use a snippet of code from a Apple programming guide, and I am getting a EXC_BAD_ACCESS when trying to pass a pointer to a function, right after doing a malloc.(For Reference:iPhone Application Programming Guide: Event Handling - Listing 3-6)The code in question is really simple:C 阅读全文
posted @ 2012-05-04 15:29 pengyingh 阅读(2920) 评论(0) 推荐(0)
摘要: Is there an integer vector struct in Cocoa or should I define my own?I am keeping track of pairs of ints and NSUIntegers as array indexes and other things.Is there something analogous to CGPoint that is already defined?I'm doing graphics stuff on iPhone if it matters.It's fairly easy to defi 阅读全文
posted @ 2012-05-04 15:18 pengyingh 阅读(574) 评论(0) 推荐(0)
摘要: strong与weak是由ARC新引入的对象变量属性ARC引入了新的对象的新生命周期限定,即零弱引用。如果零弱引用指向的对象被deallocated的话,零弱引用的对象会被自动设置为nil。@property(strong) MyClass *myObject;相当于@property(retain) MyClass *myObject;@property(weak) MyOtherClass *delegate;相当于@property(assign) MyOtherClass *delegate;强引用与弱引用的广义区别:强引用也就是我们通常所讲的引用,其存亡直接决定了所指对象的存亡。如果 阅读全文
posted @ 2012-05-04 14:49 pengyingh 阅读(218) 评论(0) 推荐(0)
摘要: http://www.cnblogs.com/Piosa/archive/2012/02/23/2365287.html首先看两个runloop的示例,来源:http://paste.lisp.org/display/86524第一个:#include<CoreFoundation/CoreFoundation.h>staticvoid_perform(void*info__unused){printf("hello\n");}staticvoid_timer(CFRunLoopTimerReftimer__unused,void*info){CFRunLoop 阅读全文
posted @ 2012-05-04 14:45 pengyingh 阅读(398) 评论(0) 推荐(0)
摘要: http://www.cnblogs.com/Piosa/archive/2011/10/15/2212824.html通常在创建完UITableViewController后,会看到UITableViewDataSource的一个实现函数如下- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = [NSString stringWithFormat:@"Cell& 阅读全文
posted @ 2012-05-04 14:43 pengyingh 阅读(367) 评论(0) 推荐(0)
摘要: 考虑下面的问题:#include <iostream>using namespace std;int Sum(int i[]){int sumofi = 0;for (int j = 0; j < sizeof(i)/sizeof(int); j++) //实际上,sizeof(i) = 4{sumofi += i[j];}return sumofi;}int main(){int allAges[6] = {21, 22, 22, 19, 34, 12};cout<<Sum(allAges)<<endl;system("pause" 阅读全文
posted @ 2012-05-04 14:34 pengyingh 阅读(174) 评论(0) 推荐(0)
摘要: http://blog.csdn.net/cpskiss/article/details/7056270不同的设备(显示器、打印机、扫描仪、摄像头)处理颜色的方式是不同的。每种设备都有其所能支持的颜色值范围。一种设备能支持的颜色可能在其它设备中无法支持。为了有效的使用颜色及理解Quartz2D中用于颜色及颜色空间的函数,我们需要熟悉在Color Management Overview文档中所使用的术语。该文档中讨论了色觉、颜色值、设备依赖及设备颜色空间、颜色匹配问题、再现意图(rendering intent)、颜色管理模块和ColorSync。在本章中,我们将学习Quartz处理颜色和颜色空 阅读全文
posted @ 2012-05-04 12:02 pengyingh 阅读(361) 评论(0) 推荐(0)
摘要: 裁剪路径当前裁剪区域是从路径中创建,作为一个遮罩,从而允许遮住我们不想绘制的部分。例如,我们有一个很大的图片,但只需要显示其中一小部分,则可以设置裁减区域来显示我们想显示的部分。当我们绘制的时候,Quartz只渲染裁剪区域里面的东西。裁剪区域内的闭合路径是可见的;而在区域外的部分是不可见的。当图形上下文初始创建时,裁减区域包含上下文所有的可绘制区域(例如,PDF上下文的media box)。我们可以通过设置当前路径来改变裁剪区域,然后使用裁减函数来取代绘制函数。裁剪函数与当前已有的裁剪区域求交集以获得路径的填充区域。因此,我们可以求交取得裁减区域,缩小图片的可视区域,但是不能扩展裁减区域。裁减 阅读全文
posted @ 2012-05-04 11:51 pengyingh 阅读(1087) 评论(0) 推荐(0)
摘要: 一般的应用在进入后台的时候可以获取一定时间来运行相关任务,也就是说可以在后台运行一小段时间。还有三种类型的可以运行在后台,1.音乐2.location3.voip大多数应用程序进入后台状态不久后转入暂停状态。在这种状态下,应用程序不执行任何代码,并有可能在任意时候从内存中删除。应用程序提供特定的服务,用户可以请求后台执行时间,以提供这些服务。判断是否支持多线程UIDevice*device=[UIDevicecurrentDevice]; BOOLbackgroundSupported=NO; if([devicerespondsToSelector:@selector(isMultitask 阅读全文
posted @ 2012-05-04 11:25 pengyingh 阅读(1345) 评论(0) 推荐(0)
摘要: iPhone OS为创建高质量的图形提供两种路径:即通过OpenGL进行渲染,或者通过Quartz、Core Animation、和UIKit进行渲染。UIKit的图形系统在iPhone OS上,所有的描画—无论是否采用OpenGL、Quartz、UIKit、或者Core Animation—都发生在UIView对象的区域内。视图定义描画发生的屏幕区域。如果您使用系统提供的视图,描画工作会自动得到处理;然而,如果您定义自己的定制视图,则必须自行提供描画代码。对于使用OpenGL进行描画的应用程序,一旦建立了渲染表面,就必须使用OpenGL指定的描画模型。视图描画周期UIView对象的基本描画模 阅读全文
posted @ 2012-05-04 11:22 pengyingh 阅读(2464) 评论(0) 推荐(2)

导航