- 博客(92)
- 收藏
- 关注
转载 macOS中的Frame & Bounds
视图的frame定义为CGRect (x,y,width,height),表示视图在父视图中的坐标位置Position为(x,y)和大小Size为(width,height),frame在父视图中有意义。视图的bounds定义为CGRect (0,0,width,height),是视图本身的内部坐标系统,bounds的坐标原点的变化会影响子视图位置。视图的子视图...
2019-01-20 12:09:18
891
转载 Swift 全功能的绘图板开发
转载请注明出处:http://blog.youkuaiyun.com/zhangao0086/article/details/43836789。 要做一个全功能的绘图板,至少要支持以下这些功能:支持铅笔绘图(画点)支持画直线支持一些简单的图形(矩形、圆形等)做一个真正的橡皮擦能设置画笔的粗细能设置画笔的颜色能设置背景色或者背景图能支持撤消与重做…我们先做一些基础性的工作,比如创建工
2015-09-13 11:11:31
851
原创 CoreLocation框架的使用
//地理编码类//1、用来根据地名来解析当前的经纬度和其他一些附属消息//2、根据经纬度来解析地名和其他消息@interface ViewController ()@property (weak, nonatomic) IBOutlet MKMapView *mapView;/* 地理编码**/@property(nonatomic,strong)CLGeocod
2015-07-16 18:35:58
762
原创 利用MapKit实现导航
#import "ViewController.h"#import #import #import "JRAnnotation.h"@interface ViewController ()@property(nonatomic,strong) CLGeocoder * coder;@property (weak, nonatomic) IBOutlet MKMapV
2015-07-16 18:33:23
901
转载 viewWillAppear和viewDidAppear什么时候被调用
viewWillAppear和viewDidAppear什么时候被调用问:当我向一个UINavigationController压入一个视图控制器的时候,1. 什么时候会触发viewWillAppear和viewDidAppear?2. 什么导致了触发viewWillAppear和viewDidAppear失败?答:当你调用pushVie
2015-07-07 18:35:54
3217
原创 去掉NSString中的HTML标签
-(NSString *)filterHTML:(NSString *)html{ NSScanner * scanner = [NSScanner scannerWithString:html]; NSString * text = nil; while([scanner isAtEnd]==NO) { //找到标签的起始位置
2015-07-07 18:34:58
762
原创 OAuth授权详解,以新浪微博为例
/*//OAuth授权过程:1、登陆账号http://open.weibo.com注册一下开发者信息,成为新浪的开发者2、点击“移动应用”,创建一个应用(勾选应用名称,应用平台就可以了),页面跳转,显示到“开发阶段即可” 3、回到主页面,点击API接口》首页》OAuth2.0授权认证 根据说明点击进入(1)OAuth2/authorize 获取code(
2015-07-07 18:32:52
793
原创 自定义tabBar控制器
一、控制器部分#import "JRTabBarConroller.h"#import "JRTabBar.h"@interface JRTabBarConroller ()@property(nonatomic,weak) UIViewController * currentVC;@end@implementation JRTabBarConrol
2015-07-07 18:26:08
665
原创 nil Nil NULL NSNull 之间的区别
nil Nil NULL NSNull 之间的区别:nil 是对objective c id 对象赋空值例如 NSString * string = [NSString stringWithFormat:@"test"]; string =nil; 对于objective c 集合类对象
2015-07-03 10:40:40
565
原创 layoutSubviews在什么时候被调用
layoutSubviews在以下情况下会被调用:1、init初始化不会触发layoutSubviews2、addSubview会触发layoutSubviews3、设置view的Frame会触发layoutSubviews,当然前提是frame的值设置前后发生了变化4、滚动一个UIScrollView会触发layoutSubviews5、旋转Screen会触发父UIView上
2015-07-03 08:53:42
1063
原创 AFNetworking框架的使用
#import "ViewController.h"#import "AFNetworking.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad];}-(void)touches
2015-06-26 12:17:40
770
原创 UIWebView的使用
@interface ViewController ()@property (weak, nonatomic) IBOutlet UIBarButtonItem *backItem;@property (weak, nonatomic) IBOutlet UIBarButtonItem *forwardItem;@property(nonatomic,weak)UIWebView *
2015-06-26 11:31:11
596
原创 UIWebView的使用,简单浏览器的实现
#import "ViewController.h"@interface ViewController () @property(nonatomic,weak)UIWebView* web;@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad];
2015-06-26 11:28:50
840
原创 Xcode 6.2 error::can only be used when targeting iOS 4.2 or later错误处理
Xcode 6.2 error::can only be used when targeting iOS 4.2 or later2015-04-24 18:36当使用Xcode打开从网上down下来的demo时,编译有时会出现can only be used when targeting iOS 4.2 or later. 这是由于IOS运行版本不同导致的。
2015-06-24 20:32:35
805
原创 EGORefreshTableHeaderView与LoadMoreTableFooterView的使用
#import "ViewController.h"#import "EGORefreshTableHeaderView.h"#import "LoadMoreTableFooterView.h"@interface ViewController ()UITableViewDataSource,UITableViewDelegate,EGORefre
2015-06-24 20:30:43
987
转载 MBProgressHUD的基本使用
MBProgressHUD的基本使用和gitHub上的Demo其实差不多,就是小整理了下,当备忘,想做复杂的效果可以参考MBProgressHUD在gitHub上的DEMO,写得也很清楚明了。先下载MBProgressHUD.h和.m文件,拖入工程。地址:MBProgressHUD以下是代码:(先在.h文件里定义 MBProgressHUD *HUD;)
2015-06-20 23:37:01
452
原创 UIActionSheet的使用
//UIActionSheet————————————————————————————————————————————————————————————————- (void) showInfo:(NSNotification *) notice{// NSLog(@"键盘马上出来了,%@",notice.userInfo);// UIActionSheet * action
2015-06-20 23:34:16
480
原创 网络状态检测Reachability
#import "Reachability.h"@interface JRViewController ()@property(nonatomic,strong) Reachability * reach;@end@implementation JRViewController- (void)viewDidLoad { [super view
2015-06-20 23:30:11
518
原创 网络请求,封装文件上传操作
头文件—————————————————————————————@interface JRUploadRequest : NSMutableURLRequest//初始化方法+ (JRUploadRequest *)uploadRequestWithPath:(NSString *)path;- (JRUploadRequest *)initWithPath:(NSString
2015-06-20 23:27:42
567
原创 ios开发,将图片存到相册中
@interface IWViewController ()@end@implementation IWViewController- (void)viewDidLoad{ [super viewDidLoad]; for (int i = 0; i NSString *file = [NSString st
2015-06-20 23:25:21
613
原创 UICollectionView 的使用详解
#import UIKit/UIKit.h>@interface ViewController : UIViewControllerUICollectionViewDataSource,UICollectionViewDelegateFlowLayout>{}@property (strong, nonatomic)UICollectionView *collectionView;@
2015-06-20 23:22:16
390
原创 NSXMLParser 解析xml详解
#import "ViewController.h"#import "Video.h"@interface ViewController ()//存储对象数组@property (nonatomic, strong) NSMutableArray *videos;// 来回拼接@property (nonatomic, strong) NSMutableString
2015-06-20 00:57:02
510
原创 DOM解析(GDataXMLNode)详解,xml解析
//(动态库环境的配置)//1、获取GDataXMLNode.h/m文件,将GDataXMLNode.h/m文件添加到工程中//2、向工程中增加“libxml2.2dylib”库(最新版)//(下边三步重要)//3、在工程的“Build Settings”页中找到“Header Search Path”项,添加/usr/include/libxml2"到路径中//4.搜索Oth
2015-06-20 00:53:25
629
原创 网络请求的缓存机制cachePolicy 和缓存的清理
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ // 缓存会自动存到以下这个文件夹中,创建三个文件,其中db文件可以使用数据库打开 NSString * tem = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUs
2015-06-20 00:50:33
774
原创 UIRefreshControl 下拉刷新
- (void)viewDidLoad { [super viewDidLoad]; //UIRefreshControl //系统自带,继承自UIControl,UIControl继承自UIView UIRefreshControl * refresh = [[UIRefreshControl alloc] init]; [self.
2015-06-20 00:48:23
502
原创 ASI框架使用全集讲解
#import "ViewController.h"#import "ASIHTTPRequest.h"#import "ASIFormDataRequest.h"#import "DACircularProgressView.h"@interface ViewController ()@property(nonatomic,strong) NSMutableD
2015-06-20 00:43:59
509
原创 自定义瀑布流
#define kWidth self.frame.size.width#define kHeight self.frame.size.height@interface JRScrollView()@property (nonatomic,strong) NSMutableArray * frameArray;@property (nonatom
2015-06-12 08:48:34
462
原创 json解析NSJSONSerialization方法
// //1、json转换成对象// NSString * path = [[NSBundle mainBundle] pathForResource:@"test.json" ofType:nil];// NSData * data = [NSData dataWithContentsOfFile:path];// NSDictionary * d
2015-06-12 08:43:09
588
原创 json解析使用第三方类库JSONKit
// 使用第三方类库JSONKit// NSString * path = [[NSBundle mainBundle] pathForResource:@"test.json" ofType:nil];// NSData * data = [NSData dataWithContentsOfFile:path]; // 1、JSON转
2015-06-12 08:42:29
603
原创 get请求的block方法
// get请求 NSURL * url = [NSURLURLWithString:@"http://192.168.2.119/test2.zip"]; NSURLRequest * requset = [NSURLRequestrequestWithURL:url]; //异步方法 NSOperationQueu
2015-06-12 08:31:43
692
原创 网络post请求
// post请求(代理方式) // NSURL * url = [NSURL URLWithString:@"http://192.168.2.162/logo.php"];// // //通过URL建立请求对象// NSMutableURLRequest * request = [NSMutableURLRequest request
2015-06-12 08:30:25
527
原创 网络get请求
//————————————————————————————————————————————————————————————————————————————// 0.文件很小的时候可以不使用请求的方法(坏处1、在主线程中,访问服务器的时候会卡死 2、文件太大的时候,一次性传输,服务器受不了)// NSURL * url = [NSURL URLWithString:@"
2015-06-12 08:28:14
499
转载 Xcode 升级后,常常遇到的遇到的警告、错误,解决方法
Xcode 升级后,常常遇到的遇到的警告、错误,解决方法从sdk3.2.5升级到sdk 7.1中间废弃了很多的方法,还有一些逻辑关系更加严谨了。1,警告:“xoxoxoxo” is deprecated解决办法:查看xoxoxoxo的这个方法的文档,替换掉这个方法即可。2,警告:Declaration of "struct sockaddr" will not b
2015-06-12 08:26:09
827
转载 iOS开发系列--并行开发其实很容易 --多线程开发
iOS开发系列--并行开发其实很容易--多线程开发概览大家都知道,在开发过程中应该尽可能减少用户等待时间,让程序尽可能快的完成运算。可是无论是哪种语言开发的程序最终往往转换成汇编语言进而解释成机器码来执行。但是机器码是按顺序执行的,一个复杂的多步操作只能一步步按顺序逐个执行。改变这种状况可以从两个角度出发:对于单核处理器,可以将多个步骤放到不同的线程,这样一来用户完成UI操
2015-06-05 19:11:01
1000
原创 NSCondition模拟买票的过程的简单实现
@interface ViewController ()@property (nonatomic,strong) NSMutableArray * array;@property (nonatomic,strong) NSCondition * condition;@property (nonatomic,strong) NSTimer * timer;
2015-06-05 19:07:20
437
原创 GCD的常用方法总结
// GCD常用方法 //———————————————————————————————————————————————————————————————————————————————— //串行队列 dispatch_queue_t queueSerial = dispatch_queue_create("jr", DISPATCH_QUEU
2015-06-05 19:04:46
545
原创 GCD刷新UI
// 刷新UI //————————————————————————————————————————————————————————————————————————————————// UIImageView * imageview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
2015-06-05 19:04:07
605
原创 GCD的四种队列,两种函数和六种组合
// 四种队列 //————————————————————————————————————————————————————————————————————————————————// //1、主队列(是串行队列)// dispatch_queue_t mainQueue = dispatch_get_main_queue();//
2015-06-05 19:02:09
2878
原创 线程锁,生产者与消费者
@interface ViewController (){ //NSLock * lock; NSCondition * condition;}//媒介,缓冲池@property (nonatomic,strong) NSMutableArray * array;@end@implementation V
2015-06-05 18:58:22
392
原创 NSThread中cancle与exit的使用
@interface ViewController ()/** 图片视图*/@property(nonatomic,weak)UIImageView * imageView;/** 图片数组*/@property(nonatomic,strong)NSMutableArray * imageArray;/**
2015-06-02 18:17:00
1189
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人