原创 swift中延遲執行

// 1.perform(必須在主線程中執行) self.perform(#selector(delayExecution), with: nil, afterDelay: 3) // 取消 NSObject.cancelPrev

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

avatarImgView.kf.setImage(with: URL(string: avarUrlOk), placeholder: nil, options: nil, progressBlock: nil, complet

原创 swift-給View添加不同的圓角

import Foundation extension UIView { /// BezierPath 圓角設置 func roundCorners(_ corners: UIRectCorner =

原创 Swift-代理用Weak修飾報錯問題

weak 屬性修飾會報錯。 ‘weak’ must not be applied to non-class-bound ‘YJReaderRecommendOneBookViewProtocal’; consider adding

原创 swift-可移動進度條

import UIKit //140 height 4 圓角就是 2 #EEEEEE 大的背景 小的背景#6CA9FF class YJProgressView: UIView { private let indi

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

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

原创 ios判斷系統版本

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

原创 GCD-定時器

#import <UIKit/UIKit.h> @interface ViewController : UIViewController @property (assign, nonatomic) NSInteger surplu

原创 Xcode開發包文件存放路徑

將下載好的iOS 包文件解壓複製:/applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport 文件夾下。 (注:打開fi

原创 UIView設置圓角

let maskPath = UIBezierPath.init(roundedRect: self.bounds, byRoundingCorners: UIRectCorner(rawValue: UIRectCorner.t

原创 iOS 獲取圖片的主題色(主色調)

-(UIColor *)mainColorOfImage:(UIImage *)image{ #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1 int bitmapInfo =k

原创 LanchScreen啓動白屏更換啓動圖無效問題

StoryBord加載LanchScreen空白問題 LanchScreen啓動白屏問題黑屏問題 有效方案 嘗試N中方式,只有從xcode10上拉入新圖片 xcode11中 其他無效方案: 把資源文件放入根目錄,會出現黑屏問題;

原创 Dispatch(01)

Dispatch 通過提交工作來調度由系統管理的隊列,在多核硬件上執行分配給隊列的任務. GCD在iOS開發中是多線程開發中用的最多的。但是卻不是像pthread和NSThread去直接操作線程的,GCD是用一個叫隊列的東西來包裝了線

原创 GCD創建更加準確的定時器

NSTimer創建的定時器不是很準確,我們可以用GCD來創建一個準確的定時器 GCD不受RunLoop的影響(比如:scrollView在拖動的時候,定時器照樣執行) @interface ViewController () /**

原创 iOS-成員變量和屬性理解

iOS 5之後: @property聲明的屬性默認會生成一個_類型的成員變量,同時也會生成setter/getter方法。 iOS 5之前: 1.一個大括號裏面定義了成員變量 2.@property聲明 3.@implement