摘要: 简单说一个Block,Block是ios4.0以后推出的一个C级别的语法,自此以后许多方法都有用Block封装,这里有必要介绍一下Block实现简单的代理回调代理文件.h文件#import @interface CustomAlertView : UIView{ void (^buttonClickBlock) (CustomAlertView *); }@property (nonatomic,copy) void (^buttonClickBlock) (CustomAlertView *);@end.m文件- (void)buttonClick{ //... 阅读全文
posted @ 2013-08-10 03:58 Asial 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 自ios SDK 5.0 苹果引用arc机制 三方库在编译上就出现了问题,这里解决办法可以部分ARC或者部分不选择ARC 方法如下: 如果当前的项目启用了ARC,而引用的第三方类库未使用ARC,那还需要在项目信息的Targets – Build Parses里找到第三方类库的.m文件,并为它们加上-fno-objc-arc标记。 对于在未启用ARC的项目用引用使用了ARC的第三方类库,则需要为第三方类库的.m文件加上-fobjc-arc标记。 另外可以通过一个编译器指令__has_feature(objc_arc)来检测项目是否使用了ARC,具体见http://clang.llvm.org.. 阅读全文
posted @ 2013-08-01 22:18 Asial 阅读(217) 评论(0) 推荐(0) 编辑
摘要: IOS 6 以前的方法1 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation2 3 {4 5 NSLog(@"shouldAutorotateToInterfaceOrientation");6 7 return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationL 阅读全文
posted @ 2013-08-01 21:47 Asial 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 创建文件夹NSString *imageDir = [NSString stringWithFormat:@"%@/Caches/%@", NSHomeDirectory(), dirName];BOOL isDir = NO;NSFileManager *fileManager = [NSFileManager defaultManager];BOOL existed = [fileManager fileExistsAtPath:imageDir isDirectory:&isDir];if ( !(isDir == YES && existed 阅读全文
posted @ 2013-04-11 21:13 Asial 阅读(469) 评论(0) 推荐(0) 编辑
摘要: Blocks的申明与调用话说Blocks在方法内使用还是挺方便的,之前都是把相同的代码封装成外部函数,然后在一个方法里需要的时候调用,这样挺麻烦的。使用Blocks之后,我们可以把相同代码在这个方法里封装起来,然后再在这个方法中需要的地方直接调用,逻辑清晰,操作也不会那么繁琐。上代码://在方法体内//block申明与初始化 void(^removePicViewBlock)(int,int) = ^(int start,int stop){ while (start <= stop) { NSAutoreleasePool *pool = [[NSAutorelea... 阅读全文
posted @ 2013-03-25 15:32 Asial 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 1.NSNotificationCenter. This is anonymous one-to-many communication. Object A posts a notification to the NSNotificationCenter, which then distributes it to any other objects listening for that notification, including Object B. A and B do not have to know anything about each other, so this is a very 阅读全文
posted @ 2013-03-25 15:24 Asial 阅读(157) 评论(0) 推荐(0) 编辑