- 博客(104)
- 收藏
- 关注
转载 码云的脚本配置Mac版
1. 生成公钥ssh-keygen -t rsa -C "your@email.com" 注意:在选择文件存储路径时,直接回车,保存在默认路径下2..查看public keycat ~/.ssh/id_rsa.pub3.将公钥添加到码云SSH公钥页面(https://gitee.com/profile/sshkeys),然后测试连接ssh -T git@gite...
2019-01-22 19:41:00 302
转载 socket 编程
#import <sys/socket.h>#import <netinet/in.h>#import <arpa/inet.h>#import <unistd.h>/* 1 创建Socket 参数 domain:协议域AF_INET->IPV4 type: socket...
2018-05-23 15:19:00 154
转载 细说KVO
1.手动控制kvo的触发+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key; 返回NO ;然后在改变value前 调用[object willChangeValueForKey:@"key"];在改变value后, 调用[object didChangeValueForKey:@"key"] ;2.隔层kvo观察...
2018-02-08 16:00:00 168
转载 脚本修改图片(添加文字和叠加)
brewupdatebrewinstallImageMagickbrewinstallghostscript如果中间发生错误,运行这个命令:brewdoctormageMagick中有许多命令,但在本教程中,你需要用到的是convert和composite(转换和组合)convert:一张图片,修改它,然后保存为一张新的图片;composite:一张图...
2017-05-19 10:51:00 512
转载 iOS APPIcon 修改(脚本)
echo "${BUILT_PRODUCTS_DIR} 运行路径echo "${SRCROOT}" 项目路径IFS=$'\n'echo $(find ${SRCROOT} -name "AppIcon60x60@2x.png")此命令$ { SRCROOT }文件夹递归搜索文件AppIcon60x60@2x.png修改APP icon的脚本IFS=$'\n'#1PATH=${PA...
2017-05-19 10:40:00 472
转载 添加引导滚动页
- (void)guidePages{ //数据源 NSArray *imageArray = @[ @"1.jpg", @"2.jpg", @"3.jpg", @"4.jpg" ]; // 初始化方法1 MZGuidePages *mzgpc = [[MZGuidePages alloc] init]; mzgpc.i...
2017-05-08 17:38:00 112
转载 取消画面切换&不使用Segue的画面切换
两个画面之间的切换只要设置Segue后就可以了,如果已经设置了Segue由于某些原因需要时Segue暂时失去作用,只要实现shouldPerformSegueWithIdentifier:sender:方法,返回NO-(BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender{...
2016-11-07 20:30:00 125
转载 iOS区分不同类型设备,加载不同的Window
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil]; } else...
2016-10-25 11:30:00 100
转载 网络基础
URL的基本格式:协议://主机地址/路径 1.协议:不同的协议代表着不同的资源查找方式,资源传输方式 2.主机地址:存放着资源的主机(服务器)的IP地址(或是域名) 3.路径:资源在主机中的具体位置URL中常见的协议:HTTP:开发中常用,超文本传输协议,访问的是远程的网路资源,格式是http://file:访问的是本地计算机上的资源,后面不需要加主机...
2016-10-21 15:43:00 85
转载 RunLoop
1.概念:运行循环,内部有do-while循环实现的保持程序的持续运行,处理APP各种事件(滑动,定时,selector),节省CPU资源,提高程序性能一个线程对应一个runloop,主线程的RunLoop随着程序已自动创建好,但是子线程的RunLoop需要手动创建每次RunLoop启动时,只能指定其中一个Mode,这个Mode被称作currentMode,如果当前的Mo...
2016-10-12 15:18:00 90
转载 多线程中并发数与挂起
1.设置最大并发数量:通过设置maxConcurrentOperationCount属性来设置,默认值是-1,不限制最大并发数量.2.队列的挂起:设置属性suspended为YES,即可将队列挂起,也可以称为暂停注意:1).当前任务处于执行状态,设置队列挂起不会影响其执行,受影响的是那些还没有执行的任务2).当队列设置为挂起状态后,可以通过修改其状态再次恢复任务3.队...
2016-10-12 10:33:00 199
转载 任务之间的依赖(NSOperation)
//任务依赖:如果A依赖B,等B执行完成后,再去执行A-(void)dependency{ NSOperationQueue *queue = [[NSOperationQueue alloc]init]; NSBlockOperation *bp1 = [NSBlockOperation blockOperationWithBlock:^{ ...
2016-10-12 10:08:00 255
转载 NSOperation使用的三种方法
//1.invacationOperation注意:在默认情况下,调用start方法后,并不会开启一条新的线程去执行操作,而是在当前线程同步执行操作;只有将NSOperation放到NSOperationQueue中,才会异步执行操作-(void)invocationOperation{ NSInvocationOperation *ip = [[NSInvocat...
2016-10-11 17:33:00 186
转载 线程通信(NSThread,NSOperation)
- (void)viewDidLoad { [super viewDidLoad]; [NSThread detachNewThreadSelector:@selector(downloadImage) toTarget:self withObject:nil]; }-(void)downloadImage{ NSUR...
2016-10-11 14:58:00 91
转载 线程安全(NSTread互斥锁)
互斥锁(同步锁):有效的防止因多线程抢夺资源造成的数据安全问题.因为线程等待,需要消耗大量的CPU资源.线程同步:指线程在同一条线上执行(按顺序的执行任务)self.tickets = 1000; self.th1 = [[NSThread alloc]initWithTarget:self selector:@selector(sellTickets:) objec...
2016-10-11 11:59:00 105
转载 NSThread的使用
-(void)creatThread1{ NSThread *thread = [[NSThread alloc]initWithTarget:self selector:@selector(run:) object:@"abc"]; thread.name = @"mythread"; [thread start];}-(void)creat...
2016-10-11 11:17:00 100
转载 iOS中多线程概述
一个ISO程序运行后,默认会开启1条线程,该线程称为"主线程"或"UI线程".主线程的主要作用:1,显示/刷新UI界面;2.处理UI时间(比如点击事件,滚动事件,拖拽事件等)不要把耗时的操作放在主线程,因为耗时操作会卡住主线程严重影响UI的流畅度,会给用户一种"卡"的感觉,体验效果不好.iOS中多线程的使用方案:1.NSThread:面向对象的使用,简单易用,可以直接操作...
2016-10-11 11:01:00 79
转载 iOS 中MD5和sha1加密
#import "CommonCrypto/CommonDigest.h"-(NSString *)getSha1String{ NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding]; uint8_t digest[CC_SHA1_DIGEST_LENGTH]; CC_S...
2016-10-11 09:57:00 147
转载 判定是不是手机号码
-(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)|(18[0-9])...
2016-10-11 09:56:00 165
转载 单例写法
CPRDataModule的单例写法+(CPRDataModule *)shareDataModule{ static dispatch_once_t token; static CPRDataModule *gDataModule=nil; dispatch_once(&token, ^{ gDataModule = [[...
2016-09-29 17:48:00 100
转载 scrollView封装广告轮播实例代码(Hank版)
#import <UIKit/UIKit.h>@interface PJXPageView : UIView/* 圆点颜色*/@property(strong,nonatomic)UIColor *PJX_currentColor;/*没选中的圆点颜色*/@property(strong,nonatomic)UIColor *PJX_other...
2016-09-29 17:47:00 81
转载 scrollView封装广告轮播示例代码
#import <UIKit/UIKit.h>@interface PJXScrollView : UIScrollView-(void)setBannerImageArray:(NSArray*)imageArray;-(void)addPageControl;@end#import "PJXScrollView.h"#define...
2016-09-23 09:44:00 83
转载 UITabBar的appear设置属性 --iOS
//主题设置 [[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"tabbar-light"]]; NSDictionary * dict = @{ NSFontAttributeName : [UIFont syst...
2016-09-08 23:05:00 98
转载 UIView的分类--iOS
#import <UIKit/UIKit.h>@interface UIView (PJXExtension)@property(assign,nonatomic) CGFloat x; //x坐标@property(assign,nonatomic) CGFloat y; //y坐标@property(assign,nonatomic) CGFloat...
2016-09-08 22:52:00 115
转载 创建不被渲染的image (uiimage扩展)--iOS
@interface UIImage (PJXExtention)@property(nonatomic,strong,readonly)UIImage * originarImage;+(UIImage *)originarImageNamed:(NSString *)name NS_DEPRECATED_IOS(2_0, 3_0,"过期了 ,用pjx_originarI...
2016-09-08 22:49:00 123
转载 引导页实现代码--iOS
@interface PJXPushGuideView : UIView+(instancetype)guideView;+(void)show;@end#import "PJXPushGuideView.h"@implementation PJXPushGuideView+(instancetype)guideView{ //加...
2016-09-08 22:28:00 106
转载 ios面试笔记
delegate和notification区别,分别在什么情况下使用?Delegate:消息的发送者(sender)告知接收者(receiver)某个事件将要发生,delegate同意然然后发送者响应事件,delegate机制使得接收者可以改变发送者的行为。通常发送者和接收者的关系是直接的一对一的关系。Notification:消息的发送者告知接收者事件已经发生或者将要发...
2016-09-06 15:57:00 593
转载 获取项目根路径,并在其下创建一个名称为userData 的目录。
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);NSString *documentsDirectory = [paths objectAtIndex:0];//创建文件系统管理器NSFileManager *fileManager = ...
2016-09-01 11:05:00 220
转载 剪切板实现拖拽代码
//// PJXDragAndDropView.m// PJXPasteboard//// Created by 王俏 on 16/8/29.// Copyright © 2016年 wangqiao. All rights reserved.//#import "PJXDragAndDropView.h"NSString *kPrivate...
2016-08-29 23:07:00 267
转载 绘制渐变背景代码
- (void)drawRect:(NSRect)dirtyRect { [super drawRect:dirtyRect]; NSGradient *backgroundGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithDeviceRed:239.0/255.0 green...
2016-08-29 10:13:00 214
转载 NSTimer操作
NSTimer *tm = [NSTimer timerWithTimeInterval:0.5f target:self selector:@selector(verifyConverting:) userInfo:nil ...
2016-08-29 09:22:00 66
转载 AlertPanel的显示加载代码
NSInteger t=NSRunAlertPanel(@"Note:", @"The PDF(s) requiring user password will be skipped. Do you want to continue?", @"No", @"Yes", NULL); if (t==1) {// [self setSubviewsE...
2016-08-29 09:21:00 85
转载 NSWindowController的初始化创建代码
-(PRAboutWindowController*)aboutCtrl{ if(_aboutCtrl == nil){ _aboutCtrl = [[PRAboutWindowController alloc]initWithWindowNibName:@"PRAboutWindowController"]; } return _abou...
2016-08-29 09:17:00 385
转载 NSViewController的初始化创建代码
-(PRParseringViewCtrl *)parseringViewCtrl{ if (!_parseringViewCtrl) { _parseringViewCtrl =[[PRParseringViewCtrl alloc]initWithNibName:NSStringFromClass([PRParseringViewCtrl class]...
2016-08-29 09:16:00 542
转载 button添加链接的title显示效果代码
-(void)setLinks{ NSString *text = @"Privacy Policy."; NSMutableAttributedString * attributedText = [[NSMutableAttributedString alloc] initWithString: text]; NSRange range = NSMak...
2016-08-29 09:13:00 405
转载 添加属性字符串的代码
+ (NSAttributedString*)attributeString:(NSString*)string color:(NSColor*)color font:(NSFont*)font alignment:(NSTextAlignment)alignment{ NSColor *txtColor = color; NSFont *txt...
2016-08-29 09:11:00 130
转载 打开openPanel的代码
- (IBAction)openPDFFile:(id)sender { NSOpenPanel *panel = [NSOpenPanel openPanel]; [panel setAllowsMultipleSelection:YES]; NSArray* fileArray = [NSArray arrayWithObjects:@"pdf", ni...
2016-08-29 09:00:00 266
转载 移除所有userDefault信息代码
- (void)clearAllUserDefaultsData{ NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier]; [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain]; ...
2016-08-29 08:59:00 159
转载 打开URL链接代码
1.打开URL#define PDF_PRODUCT_URL @"http://www.cisdem.com/pdf-password-remover-mac.html"[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:PDF_PRODUCT_URL]];2.打开本地文件#define PRPr...
2016-08-29 08:58:00 835
转载 获取info.plist的信息的代码
NSString *CurPath = [[NSBundle mainBundle] bundlePath]; NSString *xmlPath = [CurPath stringByAppendingPathComponent:@"/Contents/Info.plist"]; NSMutableDictionary* dict = [[ NSMutableDictiona...
2016-08-29 08:55:00 133
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人