iOS App技术经验类经验分享(持续更新)
iOS优化APP启动时间
https://www.jianshu.com/p/1f1c4e13b857
iOS图片设置圆角性能优化
——(第三种方法:使用CAShapeLayer和UIBezierPath设置圆角)
https://www.jianshu.com/p/6a2dc7b2e9ef
——CAShapeLayer初探
iOS-深度链接(Deeplinking)技术参考
(参考淘宝App宝贝详情从Safari打开试试):
实现场景目标:对于支持深度链接功能的移动应用,开发者可以通过调用深度链接打开应用,也可跳转到应用内指定页面,如首页,产品详细页面,购物车页面等,体验效果类似与传统网站。
iOS-深度链接(Deeplinking):https://www.jianshu.com/p/55bc8a8f0342
两种方式:
一.URL Schemes
二.Universal links(在 iOS 9 上引入了 universal links)
浅析移动应用深度链接 (Deeplinking)
iOS数据安全相关
高安全级别验证(类支付宝): 开放接口的安全验证方案(AES+RSA)
不带参数认证: https://www.jianshu.com/p/f24b74d13d63
参数签名认证(推荐代码参考): https://github.com/yubin-X/Encrypt 或者 https://github.com/HustBroventure/iOSRSAHandler
注意:请区分RSA私钥加密和RSA私钥签名:加密结果不一致,RSA私钥签名需要openssl,签名加密算法的更换:OC/Swift默认使用sha1算法,需要自己手动更改为sha256算法,不然与后台加密后数据不一致,并不能做到签名验证
支付宝openssl签名技术: https://docs.open.alipay.com/291/106130
加密流程总结:
1. 服务器端(server)和客户端(client)分别生成自己的密钥对
2. server和client分别交换自己的公钥
3. client生成AES密钥(aesKey)
4. client使用自己的RSA私钥(privateKey)对请求明文数据(params)进行数字签名
5. 将签名加入到请求参数中,然后转换为json格式
6. client使用aesKey对json数据进行加密得到密文(data)
7. client使用sever的RSA公钥对aesKey进行加密(encryptkey)
8. 分别将data和encryptkey作为参数传输给服务器端
服务器端进行请求响应时将上面流程反过来即可
WebView和JS交互
iOS WKWebView与JS交互: https://www.jianshu.com/p/4d12d593ba60
关于tableview下拉放大,附带切换导航效果
https://github.com/ArchLL/HGPersonalCenter
自己写的(方便继承用): https://www.jianshu.com/p/1efbc8c35454
图表绘画:
自定义复杂charts: https://github.com/danielgindi/Charts
简易Chart:https://github.com/JunyiXie/XJYChart
简易Chart:https://github.com/lihaiyang123/LHYChartView(不建议使用、仅供学习)
CALayer相关技术点(CAShaperlayer+UIBezierPath):
实现圆圈倒计时(参考去头条的倒计时):https://github.com/zhouxing5311/ZZCircleProgress
渐变色实现参考: https://github.com/saitjr/STLoopProgressView
UIimage、UIView自由添加圆角:https://github.com/DreamBuddy/DBCorner
UIview自定义四角阴影实现:https://github.com/YotrolZ/YCShadowView
简单使用代码展示( 左上和右上为圆角)、自己可使用分类包装:
UIBezierPath *cornerRadiusPath = [UIBezierPath bezierPathWithRoundedRect:_platFormRadiusView.bounds byRoundingCorners:UIRectCornerTopRight | UIRectCornerTopLeft cornerRadii:CGSizeMake(15, 15)];
CAShapeLayer *cornerRadiusLayer = [ [CAShapeLayer alloc ] init];
cornerRadiusLayer.frame = _platFormRadiusView.bounds;
cornerRadiusLayer.path = cornerRadiusPath.CGPath; _platFormRadiusView.layer.mask = cornerRadiusLayer;