摘要: +(BOOL) isIPAdress :(NSString *)ip{ NSArray *array = [ip componentsSeparatedByString:@"."]; NSLog(@"number of array %ld",[array count]); for (NSString *sIP in array) { NSLog(@"%@",sIP); } BOOL flag = YES; if ([array count] == 4) {//判断是否为四段 for (int i = 0; i= '0' 阅读全文
posted @ 2014-02-07 12:07 wei8 阅读(377) 评论(0) 推荐(0)
摘要: NSBundle *mainBundle = [NSBundle mainBundle]; NSArray *imageURLs = [mainBundle URLsForResourcesWithExtension:@"JPG" subdirectory:@"Demo Images"]; if ([imageURLs count] > 0) { NSMutableArray *photos = [[NSMutableArray alloc] init]; for (NSURL *imageURL in i... 阅读全文
posted @ 2013-10-22 16:16 wei8 阅读(184) 评论(0) 推荐(0)
摘要: .h#import @class BaseFileModel;typedef void (^successPreBlock)();typedef void (^failePreBlock)();@interface ImagePreviewOperation : NSOperation{ BOOL _isLocal; NSString *_compressPath; successPreBlock _success; failePreBlock _faile; BaseFileModel *_file;}-(id)initWithFile:(BaseFileMod... 阅读全文
posted @ 2013-09-16 15:00 wei8 阅读(298) 评论(0) 推荐(0)
摘要: -(void)awakeFromNib;成员变量或者属性可以在这里初始化,因为 使用storyboard 不走Init方法。 阅读全文
posted @ 2013-09-16 14:52 wei8 阅读(419) 评论(0) 推荐(0)
摘要: 最近在公司移植一款PAD应用,在使用相册和拍照功能时直接crash掉了,控制台没有任何输出,这个问题纠结了半天。使用EXCEPTION BREAKPOINT 捕获所有异常,显示 下面这条代码出问题[self.navigationController presentViewController:imagePickerView animated:YES completion:nil];看代码也没问题,就是在这个位置crash 掉,控制 台没有任何信息,很郁闷。总结如下:没有任何错误输出的情况下,使用try cash 代码块捕获异常,再把异常信息打印出来preferredInterfaceOrien 阅读全文
posted @ 2013-08-05 17:48 wei8 阅读(422) 评论(0) 推荐(0)
摘要: 原文地址:http://www.cocoachina.com/bbs/read.php?tid=149595&fpage=6[UIApplication sharedApplication].networkActivityIndicatorVisible = YES; //显示[UIApplication sharedApplication].networkActivityIndicatorVisible = NO; //隐藏让状态栏显示网络等待标志状态栏是可以通过UIApplication类提供的一些方法来修改的,比如完全去掉状态栏或者修改风格,不过这些改变只是在你的程序内部,当你退 阅读全文
posted @ 2013-08-01 18:04 wei8 阅读(216) 评论(0) 推荐(0)
摘要: 字体(列出所有字体显示效果):http://iosfonts.com/热门开源项目:https://github.com/languages/Objective-C/most_watched异常收集:http://quincykit.net/ https://github.com/kaler/CrashKit 阅读全文
posted @ 2013-08-01 18:03 wei8 阅读(139) 评论(0) 推荐(0)
摘要: 原贴:http://www.cocoachina.com/bbs/read.php?tid=79169&fpage=2编译ffmepg模拟器版本:1. 到https://github.com/gabriel/ffmpeg-iphone-build下载ffmpeg-iphone-build2.先将gas-preprocessor.pl拷贝到/usr/sbin/目录中。3.到ffmpeg官网上下载ffmpeg源码4.在终端下定位到ffmpeg的目录运行./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable- 阅读全文
posted @ 2013-08-01 17:45 wei8 阅读(373) 评论(0) 推荐(0)
摘要: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];NSArray *languages = [defaults objectForKey:@"AppleLanguages"];NSString *currentLanguage = [languages objectAtIndex:0]; 阅读全文
posted @ 2013-08-01 17:36 wei8 阅读(123) 评论(0) 推荐(0)
摘要: 最近在做视频上传的时候遇到了个问题,就是当上传自己录制的视频的时候尺寸过大,尤其是录制720p视频的时候尺寸更是不可想象,但是从iPad Library或者相册里面选择视频的时候系统会做一个压缩,不知道这是什么方式压缩的 ,求助论坛之后果。后来发现其实IOS里面是提供了几个API可以压缩视频的(准确的说应该是reEncode)。这几个API在 AVFoundation里面。写出来希望能给遇到相同的问题的朋友一些帮助。知道的就请略过了。写了一个便捷的方法- (void) lowQuailtyWithInputURL:(NSURL*)inputURL outputURL:(NSURL*)outpu 阅读全文
posted @ 2013-08-01 17:35 wei8 阅读(696) 评论(0) 推荐(0)