随笔分类 - iOS
摘要:一:下载编译脚本 地址:https://github.com/kewlbear/FFmpeg-iOS-build-script 二:下载并安装gas-preprocessor 地址:https://github.com/FFmpeg/gas-preprocessor 将文件 gas-preproce
阅读全文
摘要:NSTimer基于runloop,如果runloop的任务过于繁重,可能会导致NSTimer不准时。 使用GCD创建的定时器基于系统内核,不依赖runloop,相较于NSTimer更加准时。 @interface ViewController () @property (nonatomic,stro
阅读全文
摘要:NSTimer、CADisplayLink会对target产生强引用,如果target同时对他们产生强引用,则会发生循环引用。 以NSTimer为例,解决循环引用的问题。 方法1:使用block - (void)viewDidLoad { [super viewDidLoad]; // Do any
阅读全文
摘要:苹果对编译器在不断优化,GCD方法中的block基本都不需要使用weakself,并不会造成循环引用。 dispatch_after官方文档中对block部分的说明: 一:使用self 从ViewControllerA push 到 ViewControllerB。ViewControllerB中代
阅读全文
摘要:一、AFNetworking POST纯字符串 修改位置AFURLRequestSerialization 修改前 NSString * AFQueryStringFromParameters(NSDictionary *parameters) { NSMutableArray *mutablePa
阅读全文
摘要:UncaughtExceptionHandler.h #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN @interface UncaughtExceptionHandler : NSObject @end void Uncaught
阅读全文
摘要:- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.view.backgroundColor = [UICol
阅读全文
摘要:- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. UIImageView *imageView = [[UIImage
阅读全文
摘要:- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. // 滤镜效果 NSArray *operations = @[@"
阅读全文
摘要:#import <AVFoundation/AVFoundation.h> // 初始化方法 AVSpeechSynthesizer *speech = [[AVSpeechSynthesizer alloc]init]; // 设置内容 AVSpeechUtterance *utterance =
阅读全文
摘要:创建动画 UIDynamicAnimator *animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view]; 协议代理 @protocol UIDynamicAnimatorDelegate <NSObject> @o
阅读全文
摘要:如同任何基于C的应用程序,程序启动的主入口点为iOS应用程序的main函数。在iOS应用程序,main函数的作用是很少的。它的主要工作是控制UIKit framework。因此,你在Xcode中创建任何新的项目都配备了一个默认的主函数。除了少数特例外,你永远不应该改变这个函数的实现。 #import
阅读全文
摘要:对于iOS应用程序,关键的是要知道你的应用程序是否正在前台或后台运行。由于系统资源在iOS设备上较为有限,一个应用程序必须在后台与前台有不同的行为。操作系统也会限制你的应用程序在后台的运行,以提高电池寿命,并提高用户与前台应用程序的体验。当应用程序在前台和后台之间切换时,操作系统将会通知您的应用程序
阅读全文