摘要: 在pushViewController之前调用:1 self.hidesBottomBarWhenPushed = YES;2 ZWMessageViewController *messageController = [[ZWMessageViewController alloc] initWith... 阅读全文
posted @ 2014-10-19 16:07 纠纠结结 阅读(372) 评论(0) 推荐(0) 编辑
摘要: 1 - (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)newsize 2 { 3 // 创建一个bitmap的context 4 5 // 并把它设置成为当前正在使用的context 6 7... 阅读全文
posted @ 2014-10-19 16:04 纠纠结结 阅读(327) 评论(0) 推荐(0) 编辑
摘要: 1 + (id)sharedWhatever2 {3 static dispatch_once_t pred;4 static Whatever *whatever = nil;5 dispatch_once(&pred, ^{6 whatever = [[s... 阅读全文
posted @ 2014-10-19 16:03 纠纠结结 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 1.注册NSNotificationCenter,并设置关联1 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getArray:) name:@"getArray" object:nil];2 3 ... 阅读全文
posted @ 2014-10-19 16:01 纠纠结结 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 1 // 设置导航栏半透明背景2 UINavigationBar *navBar = self.navigationBar;3 if ([navBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) {4 [... 阅读全文
posted @ 2014-10-19 15:57 纠纠结结 阅读(473) 评论(0) 推荐(0) 编辑
摘要: 方法一(推荐):使用CALayerCALayer *middleBorder = [CALayer layer];middleBorder.frame = CGRectMake(x, y, width, height);middleBorder.backgroundColor = UIColor.C... 阅读全文
posted @ 2014-10-19 15:56 纠纠结结 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 一、UIView自带有的触摸事件- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject]; if (touch.tapCount == 2)... 阅读全文
posted @ 2014-10-19 15:44 纠纠结结 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 注:以下直接用代码示例说明一、NSFileManager运用 1 #pragma mark 使用NSFileManager进行文件操作 2 - (void)fileCheckedByFileManager 3 { 4 NSString *fileName = @"testFile"... 阅读全文
posted @ 2014-10-19 15:36 纠纠结结 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 方法一:需添加第三方Reachability代码下载链接:https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html#import "Reachability.h"#pragma ma... 阅读全文
posted @ 2014-10-19 15:24 纠纠结结 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 一、NSThreadDownloadFile是一个继承NSObject的类,当中的runDownload方法是需要放到线程中执行;ThreadDownload则是一个继承NSThread的子线程类,配合隐式创建线程的方式,执行threadD对象中的run:函数并传入字符串@"download3"//... 阅读全文
posted @ 2014-10-19 15:20 纠纠结结 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 一:NSURLConnection网络请求NSOperationQueue *queue = [[NSOperationQueue alloc] init];// 异步方法[NSURLConnection sendAsynchronousRequest:urlRequest queue:queue ... 阅读全文
posted @ 2014-10-19 14:57 纠纠结结 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 注:IOS7弃用sizeWithFont和sizeWithFont:constrainedToSize:lineBreakMode:方法1.计算一行text内容的size CGSize timeSize;if (isIOS7Height) { timeSize = [_timeLabel.te... 阅读全文
posted @ 2014-10-19 14:43 纠纠结结 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 1.UIImage图片设置的缓存问题1 //用这个方法设置图片,有缓存,且不释放2 [UIImage imageNamed:/*文件名*/ ]3 4 //没缓存,会主动释放5 [[UIImage alloc] initWithContentsOfFile: /*文件全路径*/] 2.随机数的生成ar... 阅读全文
posted @ 2014-10-19 14:25 纠纠结结 阅读(248) 评论(0) 推荐(0) 编辑