自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(23)
  • 收藏
  • 关注

原创 利用AFnetworking

AFHTTPSessionManager *manager=[[AFHTTPSessionManageralloc]init];        //拼接参数    NSMutableDictionary *parameters=[NSMutableDictionarydictionary];    parameters[@"a"]=@"list"; 

2017-03-14 21:50:38 233

原创 UICollectionView如何创建

在tableView中创建CollectionView不需要管她的宽度。//设置collectionView布局    UICollectionViewLayout *layout=[[UICollectionViewLayoutalloc]init];    //创建collectionView    UICollectionView

2017-03-14 20:54:54 270

原创 cell 全屏穿透的方法

self.tableView.contentInset=UIEdgeInsetsMake(, , , )

2017-03-11 15:32:54 229

原创 scrollView的一些功能

//取消滚动条    scrollView.showsVerticalScrollIndicator=NO;    scrollView.showsHorizontalScrollIndicator=NO;    //可以翻页    scrollView.pagingEnabled=YES;

2017-03-11 00:02:13 211

原创 iOS中发送HTTP请求的方案

1.苹果原生(自带)NSURLConnection:用法简单,最古老最经典最直接的一种方案NSURLSession:功能比NSURLConnection更加强大,苹果目前比较推荐只用这种技术CFNetwork:NSURL的底层。纯c语言第三方框架AFNetworking:MKNetworkKitNSURLConnection的使用步骤1.创建

2017-03-08 15:06:46 234

原创 tableView 分割线宽度没占据整个屏幕的宽度

解决办法self.tableView.separatorInset=UIEdgeInsetsZero; 把内边距设为0;

2017-03-07 15:28:38 239

原创 将正方形图片转成圆形图片

//从xib加载就会调用调用一次- (void)awakeFromNib {    [superawakeFromNib];    // Initialization code    _itemView.layer.cornerRadius=30;    _itemView.layer.masksToBounds=YES;第二种方

2017-03-07 15:09:08 3471

原创 JSON解析代码

方法1是JSON转OC对象方法2是OC对象转JSON 以下是示例代码#import "ViewController.h"@interface ViewController ()@end@implementation ViewController-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

2017-02-26 14:43:01 247

原创 利用NSConnection发送POST请求

跟GET请求旅游不同,以下是示例代码#import "ViewController.h"@interface ViewController ()@end@implementation ViewController-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [self asyncPos

2017-02-25 18:03:55 233

原创 NNSURLConnection 发送GET请求

1.苹果原生(自带)NSURLConnection:用法简单,最古老最经典最直接的一种方案NSURLSession:功能比NSURLConnection更加强大,苹果目前比较推荐只用这种技术CFNetwork:NSURL的底层。纯c语言第三方框架AFNetworking:MKNetworkKitNSURLConnection的使用步骤1.创建

2017-02-25 16:24:24 173

原创 网络基本概念

Get请求:在请求URL后面以?的形式加上给服务器的参数,多个参数之间用&隔开由于浏览器和服务器对URL长度有限制,因此在URL后面附带的参数是有限制的,通常不能超过1kbPOST请求:发给服务器的参数全部放在请求体中理论上,post传递的数据量没有限制(具体还得看服务器的处理能)GET和POST的选择如果要传递大量数据,比如文件上传 ,只能用POST请

2017-02-24 18:29:41 222

原创 利用runloop开启常驻线程

Runloop中自动释放池的创建和释放第一次创建:启动runloop最后一次销毁:runloop退出的时候其他时候的创建和销毁:当runloop即将睡眠的时候销毁之前的释放池,重新创建一个新的runloop在开发中的应用场景:最长使用的就是开一个常驻线程 (让一个子线程不进入消亡状态,等待其他线程发来详细,处理其他时间)在子线程中开启一个定时器在子线程中

2017-02-24 15:20:11 1523

原创 GCD定时器示例代码

#import "ViewController.h"@interface ViewController ()@property (nonatomic,strong)dispatch_source_t timer;@end@implementation ViewController-(void)touchesBegan:(NSSet *)touches withEvent:(UIE

2017-02-24 13:09:04 177

原创 runLoop运行模式示例代码

runLoop运行模式示例代码#import "ViewController.h"@interface ViewController ()@end@implementation ViewController-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{// [self timer2];

2017-02-24 01:14:48 268

原创 NSCache

NSCache示例代码如下#import "ViewController.h"@interface ViewController ()@property (nonatomic, strong)NSCache* cache;@end@implementation ViewController-(NSCache *)cache{ if (_cache==nil

2017-02-23 23:16:37 186

原创 SDWebImage的一些细节

//清空缓存    //cleanDisk:清除过期缓存,计算当前缓存的大小,和设置的最大缓存数量比较,如果超出那么会继续删除(按照文件穿件的先后顺序)    //clearDisk:直接删除重新创建    //过期时间:7天    [[SDWebImageManagersharedManager].imageCachecleanDisk]; 

2017-02-23 16:47:17 233

原创 NSOperation实现线程之间通信

方法一为下载一张图片方法二为 下载两张图片拼接成一张#import "ViewController.h"@interface ViewController ()@property (weak, nonatomic) IBOutlet UIImageView *imageView;@end@implementation ViewController-(voi

2017-02-22 03:46:55 272

原创 NSOperation的监听和依赖

示例代码#import "ViewController.h"@interface ViewController ()@end@implementation ViewController-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ NSOperationQueue *qu

2017-02-22 02:58:29 219

原创 NSOperation如何开线程

创建队列GCD:串行:create/主队列并发:create/全局并发队列NSOperation:主队列:[NSOperationQueue mainQueue] 和GCD中的主队列一样,串行队列非主队列 [[NSOperationQueue alloc]init] 非常特殊(同时具备了并发和串行的功能)默认情况下非主队列是并发队列#import "ViewCont

2017-02-21 21:21:50 199

原创 NSOperation

#import "ViewController.h"@interface ViewController ()@end@implementation ViewController-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [self blockOperation];}-(

2017-02-21 21:18:51 145

原创 单例模式

1。 arc环境下:提供全局变量static Tool *instance+(instance)allocWithZone:(struct _NSZone *)zone{if(instance==nil){instance=[super allocWithZone:zone];}return instance;}加互斥锁的方法

2017-02-21 15:38:43 147

原创 GCD常用函数

1. ios延迟执行的几种方法[selfperformSelector:@selector(方法)withObject:nilafterDelay:2.0];[NSTimerscheduledTimerWithTimeInterval:2.0target:selfselector:@selector(方法)userInfo:nilrepeats:NO

2017-02-21 01:07:46 1065

原创 GCD线程之间通信

因为在开发过程中所有的耗时操作必须在主线程中执行,所以线程之间的通信很重要,以下是示例代码#import "ViewController.h"@interface ViewController ()@property (strong, nonatomic) IBOutlet UIImageView *imageView;@end@implementation ViewContro

2017-02-21 00:32:24 312

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除