- 博客(62)
- 资源 (1)
- 收藏
- 关注
原创 实现文件共享功能
iOS 应用实现文件共享功能的详细步骤在 iOS 开发中,有时需要将应用生成的文件(如数据库文件、日志文件等)暴露给用户,以便在“文件”应用中查看、编辑或共享。本文将详细总结如何配置文件共享功能,并实现文件在“文件”应用中可见的完整流程。一、什么是文件共享功能文件共享功能允许用户通过 iOS 的“文件”应用访问和管理存储在应用沙盒内的文件。启用文件共享后,应用沙盒中的特定目录将暴露给用户。...
2024-12-26 17:30:16
793
原创 figma字重与iOS的字重转换,不要每次去查了
extension UIFont.Weight { static var w100: UIFont.Weight { .ultraLight } static var w200: UIFont.Weight { .thin } static var w300: UIFont.Weight { .light } static var w400: UIFont.Weig...
2024-12-16 22:11:21
258
原创 Swift可变参数 (Variadic Parameter)的应用
IMG_3923.jpg/// tipArray 来自服务器返回, let msg = YXTools.stringsAddSerialNumber(tipArray, ["如有疑问或需要,请联系驾校工作人员。"]) YXCustomBasicAlert.showOnlyOneActionAlert(actionTitle: "我知道了...
2023-07-04 11:52:23
274
原创 Whose view is not in the window hierarchy 错误
UIViewController*topRootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;while (topRootViewController.presentedViewController) { topRootViewController = topRootVie...
2022-09-07 17:05:05
247
原创 获取类的方法名字
//// main.m// PrintMethodNamesOfClass//// Created by jqrios on 2021/7/22.//#import <Foundation/Foundation.h>#import <objc/runtime.h>void printMethodNamesOfClass(Class cls) { ...
2021-07-22 19:34:55
339
原创 Swift Property
Stored PropertyComputed PropertyClass支持Struct支持enum不支持Computed Property 本质就是方法(函数)Stored Property(存储属性)关于Stored Property,Swift有明确规定:在创建类 或 结构体 的实例时,必须为所有的Stored Property设置一个合适...
2021-07-01 13:34:15
303
原创 Swift is
protocol Runnable { }class Person { }class Student: Person, Runnable { }var stu: Any = 10print(stu is Int)// truestu = "Jack"print(stu is String)// truestu = Student()print(stu is Student)//...
2021-07-01 11:54:15
100
原创 Swift基类和NSObject关系
class SwiftClass {}class OCClass: NSObject {}var ref = SwiftClass()var ocref = OCClass()print("Swift对象的内存:", Mems.memStr(ofRef: ref))print("NSObject对象的内存:", Mems.memStr(ofRef: ocref))Swift对象的内存: 0x000000010000c3a8 0x0000000200000003NSObject对.
2021-07-01 09:42:01
591
原创 iOS TableView的contentsize不准确?
获取contentsize不准确的原因:设置了tableView.estimatedRowHeight = 80tableView.rowHeight = UITableView.automaticDimension会导致contentsize不准确image.png文档中也对estimatedRowHeight对contentOffset和contentSize影响的描述,直接...
2021-04-11 23:29:42
1848
原创 Swift 空合并运算符(Nil-Coalescing Operator)
APIpublic func ?? <T>(optional: T?, defaultValue: @autoclosure () throws -> T?) rethrows -> T?public func ?? <T>(optional: T?, defaultValue: @autoclosure () throws -> T) rethro...
2021-03-28 11:15:50
264
原创 iOS Masonry九宫格布局 - 一行代码实现九宫格
IMG_0085.PNG各题型得分率模块,题型数量不定。这个页面使用UIScrollView,宫格模块没有使用UICollectionView,原因:1.UICollectionView继承UIScrollView,就会面临滚动视图嵌套。UICollectionView处理大量列表数据有优势,这里使用题型不超过10种,不回超出屏幕,UICollectionView复用机制体现...
2021-01-26 14:47:06
892
原创 willMoveToSuperview的使用
IMB_T2vSgG.GIF- (void)willMoveToSuperview:(nullable UIView *)newSuperview;核心代码#import "WJExamingNavbar.h"@interface WJExamingNavbar ()@property (nonatomic,strong)UILabel * title;@property (...
2021-01-25 19:18:15
746
原创 日常代码记录
//// WJOrderDetailViewController.m// KingTalent//// Created by wangjie on 2020/11/25.// Copyright © 2020 yizhilu. All rights reserved.//#import "WJOrderDetailViewController.h"#import "WJO...
2020-11-25 16:43:44
142
原创 贝塞尔曲线实现section圆角
iOS 13 新增分组圆角,属性UITableViewStyleInsetGrouped- (UITableView *)tableView{ if (!_tableView) { if (@available(iOS 13.0, *)) { _tableView = [[UITableView alloc]initWithFrame:CGRect...
2020-11-16 20:08:34
536
原创 Swift规则总结
函数结构 没有参数标签 具有参数标签 省略参数标签使用了“_” 举例 func goToWork(time:String){ print("this time is \(time)")} func goToWork(at time:String){ print("this time is \(time)")} ...
2020-08-04 11:28:05
334
原创 记一次图片传输
通过微信传输原图,收到3个文件,最大的一张6.8MB 通过AirDrop传输到Mac mini (2018),显示2.4MB ?这不可能,但是事实确实如此!通过导出功能导出...
2020-07-15 14:35:48
149
原创 2020-07-14
typedef NS_OPTIONS(NSUInteger, UIControlEvents) { UIControlEventTouchDown = 1 << 0, // 单点触摸按下事件:用户点触屏幕,或者又有新手指落下的时候。 UIControlEventTouchDownRepeat = 1 <&...
2020-07-14 10:02:45
121
原创 iOS dispatch_after
dispatch_after是来延迟执行的GCD方法,dispatch_after能让我们添加进队列的任务延时执行,该函数并不是在指定时间后执行处理,而只是在指定时间追加处理到。dispatch_queuedispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_...
2020-07-01 17:43:20
777
原创 优雅的使用枚举
//// WJSquareModel.h// KingTalent//// Created by 王杰 on 2020/6/10.// Copyright © 2020 yizhilu. All rights reserved.//#import <Foundation/Foundation.h>NS_ASSUME_NONNULL_BEGIN@inte...
2020-06-19 11:24:19
153
原创 tableView行高计算
- (CGFloat)cellHeight{ // 如果cell的高度已经计算过, 就直接返回 if (_cellHeight) return _cellHeight; // 文字 CGFloat textMaxW = [UIScreen mainScreen].bounds.size.width - 80; CGSize textMaxSize = CGS...
2020-05-28 13:50:39
187
原创 图片填充模式科普
这是一张16:9的图片.jpg上面是一张16:9的图片只有控件和图片宽高比一致,才可以做到图片不变形,内容显示完全UIViewContentModeScaleToFill内容模式缩放填充,图片全部内容展示在控件内图片充满整个控件图片变形适用场景:控件和图片宽高比不一致,但是差距不大,为了保证不看到控件背景颜色,图片稍微变形人眼看不出来。效果如下↓UIView...
2020-05-15 09:45:27
453
原创 if if和if elseif的区别
多个if是所有的if都会进行判断比如:a = 2;if(a==1) c=1;if(a==2) c=2;if(a%2==0) c=3;最终结果c=3if else if是只要有满足条件的,就不再对之后的else if进行判断比如:a=2;if(a==1) c=1;else if(a==2) c=2;else if(a%2==0) c=3;最终结果c=2...
2020-05-12 11:42:22
821
原创 masonry注意事项
mas_updateConstraints 约束冲突约束冲突引起的原因有两点:1.mas_updateConstraints 使用初始化没有出现的约束2.mas_updateConstraints 约束参考对象发生变化
2020-04-19 01:24:59
120
原创 cocoaPods 安装三方库 查看进度
pod install和pod update命令无法查看下载路径1.使用pod install --verbose --no-repo-update例如:-> Installing Bugtags (3.0.3)> Git download> Git download$ /usr/bin/git clone https://github.com/bugtags...
2020-03-25 15:44:05
660
原创 iOS indexOfObject使用
-(NSUInteger)indexOfObject:(ObjectType)anObject;点击这里官方文档Return ValueThe lowest index whose corresponding array value is equal to anObject.If none of the objects in the array is equal to anObject...
2019-12-19 20:35:45
1820
原创 Swift中值类型赋值操作
值类型赋值给var、let或者给函数传参,是直接将所有内容拷贝一份,类似于对文件进行copy、paste操作,产生了全新的文件副本。属于深拷贝(deep copy)在Swift标准库中,为了提升性能,String、Array、Dictionary、Set采取了Copy On Write的技术。比如仅当有“写”操作时,才会真正执行拷贝操作对于标准库值类型的赋值操作,Swift 能确保最佳性能,...
2019-11-27 15:09:10
615
原创 Swift学习笔记--类和结构体
https://numbbbbb.gitbooks.io/-the-swift-programming-language-/chapter2/09_Classes_and_Structures.html
2019-11-26 14:53:37
210
原创 mac OS 系统目录介绍
unix系统的通用目录/bin#bin是binary的简写,主要是一些系统必备的工具比如,cp,ls,mv,rm,sh等#英文解释:commands in this dir are all system installed user commands/sbin#sbin是管理员用于管理系统的一些必备命令,比如常用的,ifconfig,mount,reboot,shutdown等#英文解释:com...
2019-10-30 15:03:38
324
原创 Masonry约束立即生效跟约束更新
view1 = [UIView new]; [self.view addSubview:view1]; [view1 mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self.view).insets(UIEdgeInsetsMake(10, 10, 10, 10)); ...
2019-10-30 14:57:09
393
原创 多用类型常量,少用#define预处理指令
这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入欢迎使用Ma...
2019-04-08 11:06:27
292
原创 iOS开发-改变文字间距(行间距和字间距)
改变文字间距IMG_1938.PNG#import "UILabel+ChangeLineSpaceAndWordSpace.h"@implementation UILabel (ChangeLineSpaceAndWordSpace)+ (void)changeLineSpaceForLabel:(UILabel *)label WithSpace:(float)spac...
2018-04-04 09:10:11
1124
原创 根据图片长宽比例设置视图
#import "ZDHeaderView.h"@implementation ZDHeaderView- (instancetype)initWithFrame:(CGRect)frame{ if (self = [super initWithFrame:frame]) { /* 添加子控件的代码*/ CGSize size_header = [U...
2017-10-11 21:11:23
126
原创 配置PrefixHeader.pch
1PCHFile.png2先不要勾选.png3出现在了这里.png4按顺序很好找.png5拼上路径.png./ 代表根目录TableView 是项目名./TableView 意思就是你项目的根目录PrefixHeader.pch 一定要拼全Jietu20170930-193332.png2441...
2017-09-30 19:15:44
151
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人