• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






PJXWang

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

随笔分类 -  示例代码

1 2 下一页

 
码云的脚本配置Mac版
摘要:1. 生成公钥 ssh-keygen -t rsa -C "your@email.com" 注意:在选择文件存储路径时,直接回车,保存在默认路径下 2..查看public key cat ~/.ssh/id_rsa.pub 3.将公钥添加到码云SSH公钥页面(https://gitee.com/pr 阅读全文
posted @ 2019-01-22 19:41 PJXWang 阅读(360) 评论(1) 推荐(0)
取消画面切换&不使用Segue的画面切换
摘要:两个画面之间的切换只要设置Segue后就可以了,如果已经设置了Segue由于某些原因需要时Segue暂时失去作用,只要实现shouldPerformSegueWithIdentifier:sender:方法,返回NO -(BOOL)shouldPerformSegueWithIdentifier:( 阅读全文
posted @ 2016-11-07 20:30 PJXWang 阅读(153) 评论(0) 推荐(0)
iOS区分不同类型设备,加载不同的Window
摘要:if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" b 阅读全文
posted @ 2016-10-25 11:30 PJXWang 阅读(156) 评论(0) 推荐(0)
多线程中并发数与挂起
摘要:1.设置最大并发数量:通过设置maxConcurrentOperationCount属性来设置,默认值是-1,不限制最大并发数量. 2.队列的挂起:设置属性suspended为YES,即可将队列挂起,也可以称为暂停 注意: 1).当前任务处于执行状态,设置队列挂起不会影响其执行,受影响的是那些还没有 阅读全文
posted @ 2016-10-12 10:33 PJXWang 阅读(283) 评论(0) 推荐(0)
任务之间的依赖(NSOperation)
摘要://任务依赖:如果A依赖B,等B执行完成后,再去执行A -(void)dependency { NSOperationQueue *queue = [[NSOperationQueue alloc]init]; NSBlockOperation *bp1 = [NSBlockOperation bl 阅读全文
posted @ 2016-10-12 10:08 PJXWang 阅读(320) 评论(0) 推荐(0)
NSOperation使用的三种方法
摘要://1.invacationOperation 注意:在默认情况下,调用start方法后,并不会开启一条新的线程去执行操作,而是在当前线程同步执行操作;只有将NSOperation放到NSOperationQueue中,才会异步执行操作 -(void)invocationOperation { NS 阅读全文
posted @ 2016-10-11 17:33 PJXWang 阅读(353) 评论(0) 推荐(0)
线程通信(NSThread,NSOperation)
摘要:- (void)viewDidLoad { [super viewDidLoad]; [NSThread detachNewThreadSelector:@selector(downloadImage) toTarget:self withObject:nil]; } -(void)download 阅读全文
posted @ 2016-10-11 14:58 PJXWang 阅读(134) 评论(0) 推荐(0)
线程安全(NSTread互斥锁)
摘要:互斥锁(同步锁):有效的防止因多线程抢夺资源造成的数据安全问题.因为线程等待,需要消耗大量的CPU资源. 线程同步:指线程在同一条线上执行(按顺序的执行任务) self.tickets = 1000; self.th1 = [[NSThread alloc]initWithTarget:self s 阅读全文
posted @ 2016-10-11 11:59 PJXWang 阅读(135) 评论(0) 推荐(0)
NSThread的使用
摘要:-(void)creatThread1 { NSThread *thread = [[NSThread alloc]initWithTarget:self selector:@selector(run:) object:@"abc"]; thread.name = @"mythread"; [thr 阅读全文
posted @ 2016-10-11 11:17 PJXWang 阅读(123) 评论(0) 推荐(0)
iOS 中MD5和sha1加密
摘要:#import "CommonCrypto/CommonDigest.h" -(NSString *)getSha1String { NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding]; uint8_t digest[CC_SHA 阅读全文
posted @ 2016-10-11 09:57 PJXWang 阅读(179) 评论(0) 推荐(0)
判定是不是手机号码
摘要:-(BOOL)regexTel { if ( self == nil || [self length] == 0 ) { return NO; } NSString *regex = @"^((13[0-9])|(14[0-9])|(15[0-9])|(17[6-8])|(1705)|(1709)| 阅读全文
posted @ 2016-10-11 09:56 PJXWang 阅读(173) 评论(0) 推荐(0)
scrollView封装广告轮播实例代码(Hank版)
摘要:#import <UIKit/UIKit.h> @interface PJXPageView : UIView /* 圆点颜色*/ @property(strong,nonatomic)UIColor *PJX_currentColor; /*没选中的圆点颜色*/ @property(strong, 阅读全文
posted @ 2016-09-29 17:47 PJXWang 阅读(163) 评论(0) 推荐(0)
scrollView封装广告轮播示例代码
摘要:#import <UIKit/UIKit.h> @interface PJXScrollView : UIScrollView -(void)setBannerImageArray:(NSArray*)imageArray; -(void)addPageControl; @end #import " 阅读全文
posted @ 2016-09-23 09:44 PJXWang 阅读(179) 评论(0) 推荐(0)
UITabBar的appear设置属性 --iOS
摘要://主题设置 [[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"tabbar-light"]]; NSDictionary * dict = @{ NSFontAttributeName : [UIFont systemF 阅读全文
posted @ 2016-09-08 23:05 PJXWang 阅读(302) 评论(0) 推荐(0)
UIView的分类--iOS
摘要:#import <UIKit/UIKit.h> @interface UIView (PJXExtension) @property(assign,nonatomic) CGFloat x; //x坐标 @property(assign,nonatomic) CGFloat y; //y坐标 @pr 阅读全文
posted @ 2016-09-08 22:52 PJXWang 阅读(196) 评论(0) 推荐(0)
创建不被渲染的image (uiimage扩展)--iOS
摘要:@interface UIImage (PJXExtention) @property(nonatomic,strong,readonly)UIImage * originarImage; +(UIImage *)originarImageNamed:(NSString *)name NS_DEPR 阅读全文
posted @ 2016-09-08 22:49 PJXWang 阅读(228) 评论(0) 推荐(0)
引导页实现代码--iOS
摘要:@interface PJXPushGuideView : UIView +(instancetype)guideView; +(void)show; @end #import "PJXPushGuideView.h" @implementation PJXPushGuideView +(insta 阅读全文
posted @ 2016-09-08 22:28 PJXWang 阅读(324) 评论(0) 推荐(0)
获取项目根路径,并在其下创建一个名称为userData 的目录。
摘要:NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString *documentsDirectory = [paths objectAtIndex:0]; 阅读全文
posted @ 2016-09-01 11:05 PJXWang 阅读(307) 评论(0) 推荐(0)
剪切板实现拖拽代码
摘要:// // PJXDragAndDropView.m // PJXPasteboard // // Created by 王俏 on 16/8/29. // Copyright © 2016年 wangqiao. All rights reserved. // #import "PJXDragAnd 阅读全文
posted @ 2016-08-29 23:07 PJXWang 阅读(1069) 评论(0) 推荐(0)
绘制渐变背景代码
摘要:- (void)drawRect:(NSRect)dirtyRect { [super drawRect:dirtyRect]; NSGradient *backgroundGradient = [[NSGradient alloc] initWithStartingColor:[NSColor c 阅读全文
posted @ 2016-08-29 10:13 PJXWang 阅读(225) 评论(0) 推荐(0)
 

1 2 下一页