随笔分类 -  iOS 教程

摘要:-(void)get{ NSURLSession * session=[NSURLSession sharedSession]; NSURLSessionTask * task=[session dataTaskWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.xiufa.com... 阅读全文
posted @ 2016-06-02 22:07 谢小锋 阅读(202) 评论(0) 推荐(0)
摘要:NSFileHandle文件写入的好处时连续写入不会别覆盖 NSString * path;//路径 //创建一个文件句柄对象 NSFileHandle * handle=[NSFileHandle fileHandleForReadingAtPath:path]; //指定数据写入位置---文件的 阅读全文
posted @ 2016-05-10 13:51 谢小锋 阅读(277) 评论(0) 推荐(0)
摘要:cell高亮时文字颜色 cell.textLabel.highlightedTextColor= 阅读全文
posted @ 2016-05-06 10:43 谢小锋 阅读(104) 评论(0) 推荐(0)
摘要:#import <UIKit/UIKit.h> #import "AppDelegate.h" main 函数为程序入口 int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, arg 阅读全文
posted @ 2016-04-28 22:19 谢小锋 阅读(150) 评论(0) 推荐(0)
摘要:- (IBAction)action:(id)sender { count=100; self.thread1=[[NSThread alloc]initWithTarget:self selector:@selector(buy) object:@""]; self.thread2=[[NSThr 阅读全文
posted @ 2016-04-24 20:17 谢小锋 阅读(133) 评论(0) 推荐(0)
摘要:ARC的判断准则:只要没有强指针指向对象,就会释放对象 指针分2种 1强指针:默认情况下,所有的指针都是强指针 __strong 2弱指针:__weak __weak Person* p=[Person new]错误写法 用弱指针对象会被释放 属于 编译特性 strong :强指针相当于原来reta 阅读全文
posted @ 2016-04-23 23:12 谢小锋 阅读(153) 评论(0) 推荐(0)
摘要://// ViewController.m// touchID//// Created by 谢泽锋 on 16/4/1.// Copyright © 2016年 xiezefeng. All rights reserved.//#import "ViewController.h"#import < 阅读全文
posted @ 2016-04-01 11:16 谢小锋 阅读(201) 评论(0) 推荐(0)
摘要:编译:把C语言代码翻译成0和1 工具:编译器 Xcode3 gcc , Xcode4 LLVM (clang) 安装命令行工具 1.指令: cc -c 文件名.c 编译成功,会生成一个.o目标文件 语法错误会报错 2.cc 文件名 链接:其实就是把我们的.o目标文件跟系统自带的函数库合并在一起,生成 阅读全文
posted @ 2016-02-17 10:28 谢小锋 阅读(137) 评论(0) 推荐(0)
摘要:NSOperation 是个抽象的类 不具备封装操作能力,必须使用它的字累 NSInvocationOperation NSBlockOperation 自定义子类继承NSOperation NSOperationQueue 操作队列是由GCD提供的队列模型Cocoa抽象,是一套ObjectC的AP 阅读全文
posted @ 2016-01-17 17:21 谢小锋 阅读(172) 评论(0) 推荐(0)
摘要:UIImage * image2=[UIImage imageNamed:@"1"]; UIImage * image1=[UIImage imageNamed:@"1"]; UIGraphicsBeginImageContextWithOptions(CGSizeMake(200, 100), N 阅读全文
posted @ 2016-01-15 10:27 谢小锋 阅读(129) 评论(0) 推荐(0)
摘要:GCD的基本思想是将操作放在队列中执行 纯C语言 优点 1.为多核的并行运算提出了解决方案 2.自动利用更多的CPU内核 3.自动管理线程的生命周期(创建线程,调度任务,消毁线程) 4.程序员只需要告诉GCD想要执行什么任务,不需要编写任何线程管理代码 二 .任务和队列 GCD使用步骤 *定制任务( 阅读全文
posted @ 2016-01-13 13:43 谢小锋 阅读(422) 评论(0) 推荐(0)
摘要:进程 正在进行中的程序称为进程,负责程序运行的内存分配 每个进程都有自己独立的虚拟内存空间 线程 线程是进程中独立的路径(控制单元) 一个进程中至少包含一个线程,即主线程 可以将耗时的执行路径(如网络请求)放在其他线程中执行 创建线程的目的就是为了开启一条新的执行路径,运行指定的代码,与主线程中的代 阅读全文
posted @ 2016-01-12 10:04 谢小锋 阅读(172) 评论(0) 推荐(0)
摘要:它可以保证某个类创建出来的对象永远只有一个 作用 减少内存开销 如果有一些数据 整个程序中都用得上 使用同一份资源[UIApplication shareApplication] [UIDevice currentDevice] [NSUserDefaults Stander] 一般工具类使用单例模 阅读全文
posted @ 2015-12-31 17:55 谢小锋 阅读(128) 评论(0) 推荐(0)
摘要:[[UIApplication sharedApplication] setApplicationIconBadgeNumber:(这里是个数)]; 阅读全文
posted @ 2015-11-24 09:43 谢小锋 阅读(388) 评论(0) 推荐(0)
摘要:栈区的存放局部变了 由系统管理出{}后内存会被系统回收 堆区 存放对象 动态分布 不会随便被回收 需要手动释放所以oc对象有自己的引用计数器是一个整数 占有4个字节存储空间当减为0时别回收 java 是垃圾回收机制 没用既回收 当alloc new copy 创建 对象时 新对象引用计数就是1 给对 阅读全文
posted @ 2015-08-27 10:29 谢小锋 阅读(142) 评论(0) 推荐(0)
摘要:UIStoryboard *s = [UIStoryboard storyboardWithName:storyboard的名字 bundle:nil]; id viewController(所属的视图控制器) = [s instantiateViewControllerWithIdentifier 阅读全文
posted @ 2015-07-14 11:11 谢小锋 阅读(215) 评论(0) 推荐(0)
摘要:#import "ViewController.h"#import #import #import "CustomView.h"#define width self.view.frame.size.width//#define height self.view.frame.size.height@i... 阅读全文
posted @ 2015-07-08 15:52 谢小锋 阅读(181) 评论(0) 推荐(0)
摘要:是启动页停留一段时间 只需要在 AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {// Override 阅读全文
posted @ 2015-07-07 15:33 谢小锋 阅读(564) 评论(0) 推荐(0)
摘要:#import "ViewController.h" @interface ViewController ()<NSURLConnectionDataDelegate,NSURLConnectionDelegate> { NSMutableData * myImageData; int num; } 阅读全文
posted @ 2015-05-02 15:17 谢小锋 阅读(264) 评论(0) 推荐(0)
摘要:http://osp.voicecloud.cn/ // // ViewController.m // Custom声纹识别 // // Created by 谢泽锋 on 15/4/30. // Copyright (c) 2015年 谢泽锋. All rights reserved. // #i 阅读全文
posted @ 2015-04-30 11:55 谢小锋 阅读(869) 评论(0) 推荐(0)