摘要: #import <QuartzCore/QuartzCore.h> //给图层添加背景图片: myView.layer.contents = (id)[UIImage imageNamed:@"view_BG.png"].CGImage; //将图层的边框设置为圆脚 myWebView.layer.cornerRadius = 8; myWebView.layer.masksToBounds = YES; //给图层添加一个有色边框myWebView.layer.borderWidth = 5;myWebView.layer.borderColor = [[UI 阅读全文
posted @ 2012-10-25 11:18 hellocby 阅读(429) 评论(0) 推荐(0)
摘要: contentSize是scrollview可以滚动的区域,比如frame = (0 ,0 ,320 ,480) contentSize = (320 ,960),代表你的scrollview可以上下滚动,滚动区域为frame大小的两倍。contentOffset是scrollview当前显示区域顶点相对于frame顶点的偏移量,比如上个例子你拉到最下面,contentoffset就是(0 ,-480),也就是y偏移了- 480(注意向下拉,偏移是负数,向上才是正数,这个我测试过的)contentInset是scrollview的contentview的顶点相对于scrollview的位置,例 阅读全文
posted @ 2012-10-11 14:26 hellocby 阅读(156) 评论(0) 推荐(0)
摘要: iPhone开发之深入浅出 (1) — ARC是什么博主:易飞扬原文链接:http://www.yifeiyang.net/development-of-the-iphone-simply-1/iPhone开发之深入浅出 (2) — ARC之@property使用博主:易飞扬原文链接:http://www.yifeiyang.net/development-of-the-iphone-simply-2/iPhone开发之深入浅出 (3) — ARC之前世今生博主:易飞扬原文链接:http://www.yifeiyang.net/development-of-the-iphone-simply- 阅读全文
posted @ 2012-09-28 16:25 hellocby 阅读(371) 评论(0) 推荐(0)
摘要: xcode 4.2非常可恶,原来的代码里有调用performselector:withObject:的地方无一例外获得一个警告:Semantic IssuePerformSelector may cause a leak because its selector is unknownwarning倒是不影响程序运行,但是这人要是有点代码小洁癖的话,那日子就没法过了,这warning怎么看都碍眼。所以必须得想办法把它弄没了:#pragma clang diagnostic push#pragma clang diagnostic ignored "-Warc-performSelect 阅读全文
posted @ 2012-09-28 11:40 hellocby 阅读(254) 评论(0) 推荐(0)
摘要: http://raptureinvenice.com/arc-support-without-branches/ 阅读全文
posted @ 2012-09-28 11:38 hellocby 阅读(130) 评论(0) 推荐(0)
摘要: 去这里http://developer.apple.com/iphone/library/samplecode/Reachability/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007324-Intro-DontLinkElementID_2下载Reachability.m和Reachability.h,然后添加到你的项目里面,在需要测试网络连接class里面写这样的一个方法- (BOOL)testConnection {BOOL result = YES;Reachability *reach=[Reachability shared 阅读全文
posted @ 2012-09-19 17:34 hellocby 阅读(1184) 评论(0) 推荐(0)
摘要: 1.导入MessageUI.framework框架2.在需要应用的控制器头文件:#import <MessageUI/MessageUI.h>,并加入委托:<MFMailComposeViewControllerDelegate>3.实现方法:-(void)displayComposerSheet{ MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; [picker setSubject:@ 阅读全文
posted @ 2012-09-19 14:49 hellocby 阅读(4479) 评论(0) 推荐(0)
摘要: -(void)leftClick{[UIViewbeginAnimations:nilcontext:nil];//displaymode,slowatbeginningandend[UIViewsetAnimationCurve:UIViewAnimationCurveEaseInOut];//动画时间[UIViewsetAnimationDuration:1.0f];//使用当前正在运行的状态开始下一段动画[UIViewsetAnimationBeginsFromCurrentState:YES];//给视图添加过渡效果[UIViewsetAnimationTransition:UIVie 阅读全文
posted @ 2012-09-17 16:36 hellocby 阅读(300) 评论(0) 推荐(0)
摘要: nil: Anullpointer to an Objective-C object.
( #definenil((id)0) )
Nil: Anullpointer to an Objective-C class.
NULL: Anullpointer to anything else. ( #defineNULL((void *)0) )
NSNull: A class defines a singleton object used to representnullvalues in collection objects (which don't allownilvalues).
 阅读全文
posted @ 2012-09-16 21:26 hellocby 阅读(411) 评论(0) 推荐(1)
摘要: 无论是爱还是恨,你都需要单例。实际上每个iOS或Mac OS应用都至少会有UIApplication或NSApplication.什么是单例呢?Wikipedia是如此定义的:在软件工程中,单例是一种用于实现单例的数学概念,即将类的实例化限制成仅一个对象的设计模式。或者我的理解是:单例是一种类,该类只能实例化一个对象。 尽管这是单例的实际定义,但在Foundation框架中不一定是这样。比如NSFileManger和NSNotificationCenter,分别通过它们的类方法defaultManager和defaultCenter获取。尽管不是严格意义的单例,这些类方法返回一个可以在应用的所 阅读全文
posted @ 2012-08-24 16:59 hellocby 阅读(9732) 评论(0) 推荐(4)