自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 UITableView优化

UITableView优化1.按需加载,只加载目标范围内的Cell2.高度预先计算并缓存3.Cell重用,正确使用identifier4.异步绘制(sd的使用)5.尽量使用所有的viewopaque,包括Cell自身,尽量少用或者不用透明图层...

2021-06-08 20:58:39 82

原创 runtime--UITextView添加默认文字

#import <UIKit/UIKit.h>@interface UITextView (ZWPlaceHolder)/** * UITextView+placeholder */@property (nonatomic, copy) NSString *zw_placeHolder;/** * IQKeyboardManager等第三方框架会读取placeholder属性并创建UIToolbar展示 */@property (nonatomic, copy) N.

2020-12-08 18:06:25 143

原创 runtime之method_exchangeImplementations交换两个方法

#import "UIViewController+Swizzling.h"#import <objc/runtime.h>@implementation UIViewController (Swizzling)+(void)load{ //虽然load只执行一次,但是为了保险起见,我们还是给加个dispatch_once吧,良好的编程习惯,从这里开始 static dispatch_once_t token; dispatch_once(&token,.

2020-12-08 18:04:35 715

原创 CocoaHTTPServer编译报错 libxml/parser.h not found 解决方案

使用 CocoaHTTPServer 的时候,报错 libxml/parser.h not found解决办法:添加链接库 libxml2.dylib在 header search paths 处 添加 ${SDK_DIR}/usr/include/libxml2

2020-08-06 10:44:25 229

转载 xcode ios调试

升级 iOS 12 之后,使用 Xcode 9 真机调试会提示错误:Could not locate device support files.This iPhone 6 Plus is running iOS 12.0 (16A366), which may not be supported by this version of Xcode.这是因为 Xcode 9 默认没有自带 iOS 12 的调试包,下载调试包,然后重新打开 Xcode 就可以了。iOS 真机调试包集合,包含 iOS 12,下

2020-08-04 13:45:57 199

原创 swift中延迟执行

// 1.perform(必须在主线程中执行)self.perform(#selector(delayExecution), with: nil, afterDelay: 3)// 取消NSObject.cancelPreviousPerformRequests(withTarget: self)// 2.timer(必须在主线程中执行)Timer.scheduledTimer(timeInterval: 3, target: self, selector: #selector(delayExe

2020-07-03 16:19:28 4828

原创 Ambiguous use of ‘setImage(with:placeholder:options:progressBlock:completion

avatarImgView.kf.setImage(with: URL(string: avarUrlOk), placeholder: nil, options: nil, progressBlock: nil, completionHandler: nil) }不报错写法01avatarImgView.kf.setImage(with: URL(string: avarUrlOk), placeholder: UIImage(named: "mine_defualt_head"))

2020-07-03 15:46:24 625

原创 Swift-代理用Weak修饰报错问题

weak 属性修饰会报错。‘weak’ must not be applied to non-class-bound ‘YJReaderRecommendOneBookViewProtocal’; consider adding a protocol conformance that has a class boundweak与弱引用计数有关,只能修饰对象,不能修饰协议限制的any。3个解决方案:protocol YJReaderRecommendOneBookViewProtocal: NSObj

2020-06-18 15:27:39 4091

原创 swift-给View添加不同的圆角

import Foundationextension UIView { /// BezierPath 圆角设置 func roundCorners(_ corners: UIRectCorner = .allCorners, radius: CGFloat) { let maskPath = UIBezierPath( roundedRect: bounds, byRoundingCorners: corners.

2020-06-17 09:56:51 689

原创 swift-可移动进度条

import UIKit//140 height 4 圆角就是 2 #EEEEEE 大的背景 小的背景#6CA9FFclass YJProgressView: UIView { private let indicaterView = UIView() private var wholePageNum = 0 private var indivaterIndex = 0 //进度条畅读 var progressViewH: CGFloat {

2020-06-17 09:55:11 453

原创 iOS开发便捷代码--UIView设置圆角

let maskPath = UIBezierPath.init(roundedRect: self.bounds, byRoundingCorners: UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue), cornerRadii: CGSize.init(width: 50 , height:50)) let maskLayer = CAShapeL

2020-06-07 15:46:34 108

原创 ios判断系统版本

if #available(iOS 10.0, *) {}else {}if #available(tvOS 1.0, *) {}if #available(watchOS 1.0, *) {}if #available(OSX 10.11, *) {}

2020-05-26 15:04:29 402

原创 iOS 获取图片的主题色(主色调)

-(UIColor *)mainColorOfImage:(UIImage *)image{#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1int bitmapInfo =kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedLast;#elseint bitmapInfo =...

2020-04-09 19:14:55 1130

原创 iOS开发便捷路径--Xcode开发包文件存放路径

将下载好的iOS 包文件解压复制:/applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport 文件夹下。(注:打开finder 使用快捷键 command + shift + G 将红色的部分粘贴到框内 enter)...

2020-04-08 20:04:35 496

原创 LanchScreen启动白屏更换启动图无效问题

StoryBord加载LanchScreen空白问题LanchScreen启动白屏问题黑屏问题有效方案尝试N中方式,只有从xcode10上拉入新图片xcode11中其他无效方案:把资源文件放入根目录,会出现黑屏问题;将图片命名更改,重新将storyboad载入也不行;重启xcode,重启手机,clean等你不能让用户卸载重启吧,不可行...

2020-04-01 18:41:24 331

原创 GCD-定时器

#import <UIKit/UIKit.h>@interface ViewController : UIViewController@property (assign, nonatomic) NSInteger surplusSecond;@property (strong, nonatomic) IBOutlet UILabel *lblMessage;@property ...

2020-01-14 15:05:41 143

原创 pod install --verbose --no-repo-update

pod install --verbose --no-repo-updatepod update --verbose --no-repo-update

2020-01-08 15:29:32 189

原创 Dispatch(01)

Dispatch通过提交工作来调度由系统管理的队列,在多核硬件上执行分配给队列的任务.GCD在iOS开发中是多线程开发中用的最多的。但是却不是像pthread和NSThread去直接操作线程的,GCD是用一个叫队列的东西来包装了线程,所以我们在开发中只需要操作好队列就可以了。完全不用去管理线程的创建和销毁。这样就大大减少了开发中遇到莫名其妙的bug。Grand Central Dispatc...

2018-10-28 18:17:01 673

原创 GCD创建更加准确的定时器

NSTimer创建的定时器不是很准确,我们可以用GCD来创建一个准确的定时器 GCD不受RunLoop的影响(比如:scrollView在拖动的时候,定时器照样执行)@interface ViewController ()/** * 定时器(这里不用带*,因为dispatch_source_t就是个类,内部已经包含了*) */@property(nonatomic, str...

2018-09-02 12:40:45 334

原创 iOS-成员变量和属性理解

iOS 5之后: @property声明的属性默认会生成一个_类型的成员变量,同时也会生成setter/getter方法。 iOS 5之前: 1.一个大括号里面定义了成员变量 2.@property声明 3.@implementation中使用@synthesize方法。 DemoiOS5 之前是这样的@interface ViewController (){ // 1...

2018-09-02 10:38:36 226

空空如也

空空如也

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

TA关注的人

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