01 2014 档案
摘要:[CALayer release]: message sent to deallocated instance iOS内存过度释放问题解决方式:1:先找到过度释放的 内存指针 开启-僵尸模式:xcode---Product--scheme--Edit Scheme ----Diagnostics---选中 Enable Zombie Objects 然后 运行 程序 ,点出 崩溃;2:如果上面方式,还找不到 过度释放内存的指针; xcode--Product--Profile---选择 Zombiles 即可,会自动开启程序内存调度工具然后点击运行的程序,点出 崩溃的页面:出现如图,然后,点击
阅读全文
摘要:iOS 状态栏和导航条配置一:隐藏: [self.navigationController setNavigationBarHidden:YES animated:YES]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];二:状态值参考:http://beyondvincent.com/blog/2013/11/03/120-customize-navigation-status-bar-ios-7/http://book.51cto.com/ar...
阅读全文
摘要:iOS 去掉tabaar上面的 一条线利用一个 1像素高的图片[[UITabBar appearance] setShadowImage:[UIImage imageNamed:@"transparentShadow.png"]];参考:http://stackoverflow.com/questions/14371343/ios-uitabbar-remove-top-shadow-gradient-line
阅读全文
摘要:iOS子线程操作检测版本更新,有新版本通知用户更新 CheckVersion一:如何使用:#import "CheckVersion.h" //输入你的app在appStore的 id [CheckVersion check_APP_UPDATE_WITH_APPID:@"350962117"];上述代码写完就可以了,当用户打开app检测到新版本时,为通知用户,更新,并显示最新版本的更新内容; 二:CheckVersion 类//// CheckVersion.h// TopProgressView//// Created by cocoajin on
阅读全文
摘要:iOS arc和非arc 适用 宏1:使用宏+ (void)showAlertWithMessage:(NSString *)messages{ dispatch_async(dispatch_get_main_queue(), ^{ UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"版本更新提示" message:messages delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; [alert show];
阅读全文
摘要:synthesis-of-weak-property-only-allowed-in-arc-or-gc-mode ARC属性错误提示:1:确认你的项目是 ARC环境;2:如果 ARC下出现上面的提示,那找到 项目里面 weak 的属性,改为 assign参考:http://stackoverflow.com/questions/18936209/synthesize-of-weak-property-is-only-allowed-in-arc-or-gc-mode-with-first-comp
阅读全文
摘要:iOS 本地通知 操作1:配置通知:然后退出程序;UILocalNotification *localNotif = [[UILocalNotification alloc] init];localNotif.fireDate = date; // date after 10 sec from nowlocalNotif.timeZone = [NSTimeZone defaultTimeZone];// Notification detailslocalNotif.alertBody = text; // text of you that you have fetched// Set t..
阅读全文
摘要:iOS tabbar 图片,最佳大小方式文档大小 30 *30retaina 60 *60最佳大小 48 *32参考:http://stackoverflow.com/questions/151746/iphone-tab-bar-item-image-resolution
阅读全文
摘要:iOS 检查app版本更新操作1:获取本地安装的版本信息:[NSString stringWithFormat:@"Version %@ (%@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"], kRevisionNumber]2:根据appStore上的 appid查询 appStore上的版本信息: 调用接口:http://itunes.apple.com/lookup?id=350962117 id 是app的 在appStore的id 解析上述
阅读全文
摘要:UISegmentedControl 修改字体大小 和 颜色大小: UIFont *font = [UIFont boldSystemFontOfSize:14.0f]; NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:UITextAttributeFont]; [sortListSeg setTitleTextAttributes:attributes ...
阅读全文
摘要:UITableView Scroll to top 手动设置tableview 滚动到 顶部[mainTableView scrollRectToVisible:CGRectMake(0,0,1,1) animated:YES];[mainTableView setContentOffset:CGPointZero animated:YES];参考:http://stackoverflow.com/questions/724892/uitableview-scroll-to-the-tophttp://stackoverflow.com/questions/19243177/how-to-sc
阅读全文
摘要:xcode arc 下使用 block警告 Capturing [an object] strongly in this block is likely to lead to a retain cycle” in ARC-enabled code解决方法:方法一: ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:Api]]; __block ASIHTTPRequest *brRequest = request; [request setCompletionB...
阅读全文
摘要:iOS key value coding kvc在接收json数据与 model封装中的使用使用 kvc 能够极大的简化代码工作,及以后的接口维护工作;1:先创建MovieModel类.h和 .m 注意Model类的属性根据 后台接口返回的 json数据 里面的字段对应,一一对应;// Created by cocoajin on 14-1-15.// Copyright (c) 2014年 www.zhgu.net. All rights reserved.//#import @interface MovieModel : NSObject@property (nonatomic,st...
阅读全文
摘要:NSData 转 bytes 字节数据NSData *data = [NSData dataWithContentsOfFile:filePath];NSUInteger len = [data length];Byte *byteData = (Byte*)malloc(len);memcpy(byteData, [data bytes], len); NSString *strPath = @"/Users/user/Desktop/jkk.txt"; NSLog(@"string = %@",[[NSString alloc]initWithCon
阅读全文
摘要:git commit 出现 changes not staged for commit 错误修复:参考:http://stackoverflow.com/questions/8488887/git-error-changes-not-staged-for-commit
阅读全文
摘要:iOS exit(),abort(),assert()函数区别exit() 退出程序abort() 停止程序,assert()检查里面的参数如果为nil抛出异常;
阅读全文
摘要:ios 程序发布使用xcode工具Application Loader 正在通过ITUNES STORE进行鉴定错误一:此错误会导致上传程序,一直停留在验证阶段,而没有一点上传进度;结果会苦等半天,无果;二:修复此错误注意点:如上图:注意,选择的target, 里面的Distribution 里面的 设置参考:http://blog.csdn.net/topbar/article/details/12850451http://blog.csdn.net/topbar/article/details/12909155
阅读全文
摘要:iOS mac添加证书 不能修改“System Roots”钥匙串错误如图:解决方式:打开钥匙串---登录---,直接把证书拖过来然后,查看--我的证书,里面,找到证书,即可
阅读全文
摘要:一:在同一个view上加载,UITapGestureRecognizer手势,UIButton 行为,UITabelView点击事件冲突;二:解决方式: 在UITapGesttureRecognizer的手势的代理UIGestureRecognizerDelegate里面屏蔽上面的冲突事件三:如代码: //处理键盘取消 UITapGestureRecognizer *resinTheInput = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(resignTheInPuts)]; re...
阅读全文
摘要:一:NSUserDefaults支持的数据格式有:NSNumber(Integer、Float、Double),NSString,NSData,NSArray,NSDictionary,BOOL类型;二:可以把自定义的对象,转换为NSData来达到存储对象到NSUserDefaults的目的;如代码: 1:model.h #import @interface ReplayModel : NSObject@property (nonatomic,strong)NSNumber *useTimes; //使用次数@property (nonatomic,strong)NSDate *a...
阅读全文
摘要:一:如下代码 //对数据按次数排序 NSArray *sortArrays = [pinCiDataArray sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { NSNumber *num1 = [(ReplayModel *)obj1 useTimes]; NSNumber *num2 = [(ReplayModel *)obj2 useTimes]; return [...
阅读全文
摘要:Easiest way:// Prefs.h#define PREFS_MY_CONSTANT @"prefs_my_constant"Better way:// Prefs.hexternNSString*const PREFS_MY_CONSTANT;// Prefs.mNSString*const PREFS_MY_CONSTANT =@"prefs_my_constant";http://stackoverflow.com/questions/538996/constants-in-objective-c
阅读全文