iOS 开发知识点汇总

1,194 阅读5分钟

每个都会涉及到一个知识点,后期会整理成一个一个模块

static inline void

HSNumbersViewCell.m文件中

static inline void HSNumbersAdjustRowView(UIView *self, HSNumbersRowView *rowView) {
    if (@available(iOS 11.0, *)) {
        rowView.frame =
            CGRectMake(self.bounds.origin.x + rowView.edgeInsets.left, self.bounds.origin.y + rowView.edgeInsets.top,
                       self.bounds.size.width - rowView.edgeInsets.left - rowView.edgeInsets.right - self.safeAreaInsets.right - self.safeAreaInsets.left,
                       self.bounds.size.height - rowView.edgeInsets.top - rowView.edgeInsets.bottom);
    } else {
        rowView.frame = CGRectMake(self.bounds.origin.x + rowView.edgeInsets.left, self.bounds.origin.y + rowView.edgeInsets.top,
                                   self.bounds.size.width - rowView.edgeInsets.left - rowView.edgeInsets.right,
                                   self.bounds.size.height - rowView.edgeInsets.top - rowView.edgeInsets.bottom);
    }
};

gitflow 流

AsyncDisplayKit文档

AsyncDisplayKit文档 AsyncDisplayKit文档

uiview 刷新机制 生命周期

iOS view如何刷新 ios uiview 如何刷新_IOS刷新view的几个方法

iOS boundingRectWithSize计算文字高度不准问题

    CGRect VIXLabelRect = [self.VIXLabel.text boundingRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:self.VIXLabel.font} context:nil];
[self.VIXLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.VIXBGView.mas_top);
        make.left.equalTo(self.VIXBGView.mas_left);
        make.bottom.equalTo(self.VIXBGView.mas_bottom);
        make.width.mas_equalTo(ceilf(VIXLabelRect.size.width));
    }];

计算字符串的宽度和高度

masonry 更新及高阶使用

自动布局与Masonry使用注意事项

iOS Masonry控件等比例\等间距布局

使用Masonry代码进行屏幕适配的详细介绍

git 中忽略 UserInterfaceState.xcuserstate

正解--->:git 中忽略 UserInterfaceState.xcuserstate

参考创建gitignore

MVC 实际案例讲解iOS设计模式——MVC模式

iOS架构模式(MVC/MVCS/MVP/MVVM/VIPER)

约束相关

关于代码动态修改xib内控件尺寸

自动化打包

jenkins + 蒲公英

git

mac端 sourceTree 解决remote: HTTP Basic: Access denied报错

UIView

UIView文档

setNeedsLayout和layoutIfNeeded看我就懂!

cocoapods私有化仓库

CocoaPods搭建私有库

xcrun: error: unable to find utility "simctl" 错误解决方案

pod repo push LSHSpec LSHPodLib.podspec 时报错The NAME.podspec specification does not validate 参考下面的方法

The NAME.podspec specification does not validate

RAC

image.png

🔥🔥🔥 iOS开发技术要点汇总,核心功能配备文档。表情键盘布局、大文件分片上传、基于MVC的基类设计、MVVM+RAC实践、微信朋友圈实现方案等。

🔥 iOS 利用MVVM + RAC + ViewModel-Based Navigation来搭建微信(WeChat 7.0.0+)的整体基本架构,以及实现微信朋友圈、通讯录、下拉小程序、搜索等主要功能,代码规范惊为天人、注释详解令人发指、细节处理精益求精、核心功能配备文档、接近98%还原度的原生App视觉体验,代码不多,注释多。(持续更新,敬请期待,欢迎Star和Fork…)

雷纯锋大神开源的MVVMReactiveCocoa的框架

iOS开发ReactiveCocoa学习笔记(一)

iOS: RAC篇 - RACSignal一欧Yiou

 导入

 pod 'ReactiveCocoa', :git => 'https://github.com/zhao0/ReactiveCocoa.git', :tag => '2.5.2'

//相关头文件导入
#import "RACSignal.h"
#import "RACSubscriber.h"
#import "RACDisposable.h"
#import "subAViewController.h"
#import "RACSubject.h"
#import "RACCommand.h"
#import <RACEXTScope.h>
#import "RACSubscriptingAssignmentTrampoline.h"
#import "NSObject+RACPropertySubscribing.h"
#import "UIControl+RACSignalSupport.h"
#import "NSNotificationCenter+RACSupport.h"
#import "NSObject+RACLifting.h"

相关demo参考 https://www.cnblogs.com/ningmengcao-ios/p/6803878.html

断言NSAssert()和NSParameterAssert区别和用处

《如何理解UIButton的imageEdgeInsets和titleEdgeInsets》修复图片错乱问题

_cmd代表当前selector

-(void)touchABC
{
    NSLog(@"打印结果:%@",NSStringFromSelector(_cmd));
    //打印结果:touchABC
}

Git回滚到历史节点(SourceTree篇)

xcode一直转圈

1.清除XCode的缓存,再重启XCode.

rm -frd ~/Library/Caches/com.apple.dt.Xcode/*
rm -frd ~/Library/Developer/Xcode/DerivedData

2.有些项目需要使用旧版编译系统,File-> workspace/project setting

F7584D5B-275E-483C-9E9C-67A2A962275C.png

xcode13 报错Cycle in dependencies between targets 'HSAWTableView' and 'HSLogicKit-7e8767..

20211029193842.jpg

十分钟学会Charles抓包(iOS的http/https请求)

library not found for -libstdc++.6.0.9

经常出现的路径找不到,经常变动,所以推荐用网上最新的路径吧

NSSetUncaughtExceptionHandler处理异常

iOS NSSetUncaughtExceptionHandler 方法 并存到本地或者上传到本地服务器

音视频处理

# 如何优雅地使用iOS系统相机、相册

# iOS开发之UIImagePickerController(拍照和录像)

Use of undeclared identifier 'kUTTypeMovie'

# iOS获取视频第一帧

# avplayer视频重复循环播放,视频重播

PHAsset获取图片和获取视频,PHAsset转换为Data.封装等.!!!

## Photos框架之保存照片到系统图库

## Photos框架之视频相关

Move Forward 主页写了很多不错的文章

# iOS照片框架-PhotoKit

Photos 框架实践以及坑 相册变动通知监听

UICollectionView

# UICollectionView设置header悬浮效果

# iOS中UICollectionView添加头视图

# PHImageRequestOptions

# 坑爹的PHImageManager和PHImageRequestOptions

# 短视频软件开发:如何实现在iOS系统相册中选取视频

# iOS 开发之照片框架PhotoKit 详解 上

获取顶层视图

大概可以分为如下几种类型

  • 根视图
  • tabbarviewcontroller
  • uinavigationViewcontroller
  • presentedViewController

iOS13获取根视图的方法

@implementation UIViewController (common)

+(void)load
{
   
}
//获取根视图
+ (UIWindow *)keyWindow{
    UIWindow  *foundWindow = nil;
    NSArray   *windows = [[UIApplication sharedApplication]windows];
    for (UIWindow *window in windows) {
        if (window.isKeyWindow) {
            foundWindow = window;
            break;
        }
    }
    return foundWindow;
}
//获取顶层视图
-(UIViewController *)currentTopViewcontroller{
    UIWindow *theWindow = [UIViewController keyWindow];
    UIViewController *TopVC = theWindow.rootViewController;
    while (TopVC.presentedViewController) {
        TopVC = TopVC.presentedViewController;
    }
    if ([TopVC isKindOfClass:[UITabBarController class]]) {
        UITabBarController *tabVC = (UITabBarController *)TopVC;
        UIViewController *selectedVC = tabVC.selectedViewController;
        if ([selectedVC isKindOfClass:[UINavigationController class]]) {
            UINavigationController *navVC = (UINavigationController *)selectedVC;
            TopVC = [navVC.childViewControllers lastObject];
        }
        else
        {
            TopVC = selectedVC;
        }
    }
    else if ([TopVC isKindOfClass:[UINavigationController class]])
    {
        UINavigationController *navVC = (UINavigationController *)TopVC;
        TopVC = [navVC.childViewControllers lastObject];
    }
    return TopVC;
}

@end

iOS链式编程之block作为返回值使用
iOS 文件大小转换成 KB、MB、GB 。。。
iOS--NSNotificationCenter多次接收问题的总结
# iOS 画三角形、圆形、矩形,一看就会那种

UIBezierPath使用

# ios实现颜色渐变的几种方法
# iOS 获取某个控件相对于屏幕的位置

NSInvocation

NSInvocation的基本使用

使用 NSInvocation 向对象发送消息

OC 中的 @encode

iOS系统3DTouch全解析

UIBezierPath

iOS 部分圆角+边框的实现(防边框被切)

iOS开发之判断横竖屏
iOS-KVO(键值监听)
iOS 保持界面流畅的技巧
APNs调试工具Knuff介绍
iOS中获取各种文件的目录路径的方法
了解IOS沙盒... NSTemporaryDirectory()
UIWindow的windowLevel属性
【iOS】视频全屏退出后,导航栏向上偏移20
IOS10 Notification远程推送通知(三)
iOS 状态栏的隐藏显示与状态栏样式的设置
# iOS浮点数去掉小数点之后的0

# 关于转换坐标的一些探索

20210917160657.jpg

image.png

# iOS - 关于 GCD 的一些总结 # iOS的锁屏和解锁的时间机制 # iOS 更改状态栏和导航栏的颜色

va_list、va_start和va_end使用

KVOController

# iOS 设置横屏导致崩溃!

后记

IMG_0294.HEIC.JPG