- 博客(44)
- 资源 (1)
- 收藏
- 关注
原创 UIBarButtonItem 设置图片颜色变成系统蓝色解决
设置图片模式[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"image"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(cl...
2019-07-01 11:01:35 4209
转载 iOS事件分发
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event;- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;https://www.jianshu.com/p/c87de31b3985
2019-06-18 18:02:28 158
原创 Xcode 快捷配置
一、属性快捷呼出@property (nonatomic, copy) <#Class#> *<#name#>;然后添加到代码块,添加快捷呼出(xcode10 拖不了代码到代码块,选择代码块片段,右键create code snippet)...
2019-06-18 15:27:16 146
原创 CocoPods 构建自己的项目
一、项目创建1、GitHub上创建自己的项目并设置开源协议(忘记添加开源协议,可以添加文件再制定)2、发布release版本并设置tag二、发布到pod上1、到项目同级目录,运行pod spec create name2、编辑name.podspec文件Pod::Spec.new do |spec| spec.name = "XFPro...
2019-06-14 17:40:33 494
转载 给github已有仓库添加协议
1、首先进入你的“代码仓库”,点击"Create new file"。2、这时github的新页面上,有一个空格让你填入文件名称。在输入框输入文件名”LICENSE", 然后点击右侧Choose a license template3、出现一系列协议可供选择,选择自己想要的即可。4、点击“Commit new file”(选择提交到master,不提交到分支),这时你添加的开源协议就在...
2019-06-14 14:57:26 1082
原创 FMDB使用
+ (instancetype)sharedInstance;/** 建表 */- (void)createTableWithTableName:(NSString *)tableName;/** 插入 */- (void)insertTableName:(NSString *)tableName student:(Student *)student;/** 删除 */- (void...
2019-06-05 14:51:05 96
原创 NSTimer 防止主线程UI阻挡
1、改变model [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];2、开辟子线程@property (nonatomic, strong) NSThread *myThread;- (void)dealloc{ [self.myThread cancel];...
2019-05-07 23:03:55 338
原创 iOS NSTimer 后台继续运行
加上以下这句代码[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
2018-11-14 15:46:29 1624
原创 iOS遍历数组同时删除数组元素
1、for循环NSMutableArray *arr = [NSMutableArray arrayWithObjects:@"1",@"2",@"3",@"4",nil];for (int i = 0; i < arr.count; i++) { [arr removeObject:arr[i]];}2、创建中间数组NSMutableArray *arr = [...
2018-10-23 16:08:23 2996
原创 NSTimer 循环引用问题解决
1、改变target为非selfself.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self.viewModel selector:@selector(countdown:) userInfo:nil repeats:YES];2、iOS10以后提供了block实现__weak __typeof(self) w...
2018-10-23 11:53:56 731
原创 归档 解档
首先遵循 NSCoding 协议 并实现;@interface BigPerson : NSObject <NSCoding>@property (nonatomic, copy) NSString *name;@property (nonatomic, assign) int age;@property (nonatomic, assign) BOOL sex;@pr...
2018-10-10 15:55:43 219
原创 iOS +(void)load运行流程解析和运用总结
1、load函数只要你动态加载或者静态引用了这个类,那么load就会被执行,它并不需要你显示的去创建一个类后才会执行,同时只执行一次。2、顺序:父类 -> 子类 -> 同级类(同级顺序不定) -> 子类+category -> main -> appdelegate...
2018-10-10 14:46:47 492
原创 当前界面多个TextField,代理方法中判断是哪个(每个textField都会走一遍代理)
if (textField == self.textField && textField.isFirstResponder) {}
2018-10-10 13:59:00 1291
原创 提取ipa素材
github上搜索iOS-Images-Extractor参照:https://jingyan.baidu.com/article/a501d80c224bacec630f5edc.html
2018-10-10 13:52:40 472
原创 获取App ipa包
通过App Store下载Apple Configurator 2;参照:https://www.jianshu.com/p/7710c68f38cf
2018-10-10 13:51:16 3662
原创 runtime
#import <objc/runtime.h>一、runtime 消息转发原理三次转发流程1、动态方法解析+ (BOOL)resolveInstanceMethod:(SEL)sel;+ (BOOL)resolveClassMethod:(SEL)sel;2、备用接收者- (id)forwardingTargetForSelector:(SEL)aSele...
2018-10-09 14:28:36 329
原创 Cocos2dx-3.x 新建项目
1、终端进入目录 ……/cocos2d-x-3.16/tools/cocos2d-console/bin/ 2、终端运行命令 cocos new Demo2 -p com.cocos2dx.org -l cpp -d …./codes (cocos new 项目名称 -p 包名 -l 语言 -d 生成文件位置)
2017-10-19 11:45:50 10606
原创 Cocos2dx-3.x 打包编译到Android Studio
1、有新文件增加先修改 ……/Demo/proj.android-studio/app/jni/Android.mk 文件 LOCAL_SRC_FILES := hellocpp/main.cpp \ ../../../Classes/AppDelegate.cpp \ ../../../Classes/code1
2017-10-19 10:11:56 1859
原创 Xcode7添加 .dylib静态文件
a、选择Build Phases —> Link Binary With Libraries —> + b、add Other… —> 快捷键(command + shift + G) c、输入 /usr/lib d、选择想要加入的文件
2016-07-06 15:03:15 298
原创 关于rangeOfString判断是否存在字符串bug
NSString *testStr; NSLog(@”—–>%lu,%lu”, [testStr rangeOfString:@”=”].location,[testStr rangeOfString:@”=”].length); if ([testStr rangeOfString:@”=”].location != NSNotFound) { NSLog(@
2016-05-26 14:29:38 464
原创 pch文件添加
添加新文件, 选择iOS-Other-PCH File 设置配置 target-Build Settings 搜索 header 选择Prefix Header 填入 工程名/**.pch
2016-05-16 17:43:21 282
原创 xib 创建view加载
CustomView *v = [[[NSBundle mainBundle] loadNibNamed:@"CustomView" owner:self options:nil]lastObject]
2016-05-16 11:05:58 232
原创 注册cell
//xib[_tabView registerNib:[UINib nibWithNibName:@"CustomCell" bundle:nil] forCellReuseIdentifier:@"cellID"]//代码[_tabView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellID"]
2016-05-16 11:04:06 254
原创 Xcode快捷操作
1、工程导航器 command + 1~8 command + 0 开启/关闭 2、实用工具面板 command + option + 1~6 command + option + 0 开启/关闭 3、
2016-03-07 10:18:15 175
原创 使用UIAlterView时设置window问题
//取出的是当前window,是UIAlterView生成的windowUIWindow *window = [UIApplication sharedApplication].keyWindow;//取第一个window,为程序开始的windowUIWindow *window = [[[UIApplication sharedApplication] windows] firstObjec
2016-03-02 17:41:17 392
原创 复制到剪切板
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];pasteboard.string = @"content";
2016-02-26 17:23:01 337
原创 tabbar显示原图
nav.tabBarItem.image = [[UIImage imageNamed:tabBarIcons[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
2016-01-18 10:07:29 354
原创 pod install 失效问题
pod install 换成 pod install –verbose –no-repo-update 这个命令,前面的命令被墙了
2016-01-14 16:40:13 239
原创 CoreAnimation学习(图层)
UIView和CALayer最大的不同是CALayer不处理用户的交互,不清楚具体的响应链于是就不能够响应事件。一个试图只有一个相关联的图层(自动创建),同时它可以支持添加无数多个子图层。CALayer的寄宿图(即图层中包含的图):layer.contents = (__bridge id)image.CGImage; //添加图片layer.contentsGravity = kCAGra
2015-12-30 11:41:29 226
原创 调用系统电话
第一种:[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://10086"]];第二种:UIWebView*callPhoneWebview =[[UIWebView alloc] init];NSURL *telURL =[NSURL URLWithString:@"tel:10086"]; //(tel
2015-12-28 14:18:16 257
原创 键盘遮挡解决
- (void)dealloc{ [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKey
2015-12-28 10:37:54 314
原创 动态更新约束
/** * 键盘即将出现 */- (void)keyboardWillShow:(NSNotification *)notif{ NSDictionary *info = [notif userInfo]; NSValue *value = [info objectForKey:UIKeyboardFrameBeginUserInfoKey]; CGSize key
2015-12-25 10:04:48 288
原创 NSDate 与 NSDateFormatter
NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeValue];NSDateFormatter *formatter = [[NSDateFormatter alloc] init];[formatter setDateFormat:@"yyyy-MM-dd hh:mm:ss"];//hh代表几位01/1NSString *tim
2015-12-21 15:25:21 212
原创 设置父视图的alpha不影响子视图的
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.7];
2015-12-17 10:49:42 467
原创 获取网络时间
{ NSURLConnection *_connection; void(^_netWorkTimeBlock)(NSString *netWorkTime);}/** * 获取网络时间 * * @param nowNetWorkTimeBlock 返回时间 / 或者无网络状态信息 */- (void)getNetworkTimeBlock:(void(^)(
2015-12-08 14:49:38 577
gif制作神器
2018-01-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人