- 博客(465)
- 收藏
- 关注
原创 CFHTTPMessageRef to NSDictionary
NSDictionary *headFields = CFBridgingRelease(CFHTTPMessageCopyAllHeaderFields(webSocket.receivedHTTPHeaders));
2022-08-24 21:43:53 856
原创 Multiple commands produce ‘.../xxx.app/Assets.car‘问题
私有库使用Images.xcassets会出现Assets.car生成多次导致冲突的问题.在Podfile文件添加。
2022-07-25 14:30:28 616
原创 swift读取bundle文件
if let filepath = Bundle.main.path(forResource: "test", ofType: "html") { do { } catch { }}
2022-07-19 16:25:50 1240
原创 swift获取url参数
# swift获取url参数```swiftpublic extension URL { var urlParameters: [String: String]? { guard let components = URLComponents(url: self, resolvingAgainstBaseURL: true), let queryItems = components.queryItems else { return nil } ret
2022-07-07 21:59:06 1560
原创 ios判断当前线程是否是主线程
ios判断当前线程是否是主线程BOOL isMainThreadB = [[NSThread currentThread] isMainThread];
2022-05-23 18:14:40 948
原创 navigationBarHidden导致返回手势失效的问题
navigationBarHidden导致返回手势失效的问题返回手势失效:self.navigationController.navigationBarHidden = YES;改成:self.navigationController.navigationBar.hidden = YES;就正常了, 很诡异.
2022-05-10 17:46:33 339
原创 ios获取当前方法的调用者
ios获取当前方法的调用者NSArray *syms = [NSThread callStackSymbols];NSLog(@"debug: caller: %@ ", [syms objectAtIndex:1]);
2022-05-05 10:01:29 600
原创 ios全局隐藏键盘
ios全局隐藏键盘[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];
2022-04-27 23:09:38 290
原创 创建只有上下或者左右手势的UIPanGestureRecognizer
创建只有上下或者左右手势的UIPanGestureRecognizerPanGesture.h#import <UIKit/UIKit.h>NS_ASSUME_NONNULL_BEGINtypedef NS_ENUM(NSInteger, PanDirection) { PanDirectionVertical, PanDirectionHorizontal,};@interface PanGesture : UIPanGestureRecognizer
2022-04-18 12:22:48 367
原创 WKWebView添加header
WKWebView添加headerNSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestReloadRevalidatingCacheData
2022-04-08 16:20:39 873
原创 UITextfield移动光标到行尾
UITextfield移动光标到行尾UITextPosition *position = [textField endOfDocument];textField.selectedTextRange = [textField textRangeFromPosition:position toPosition:position];
2022-04-03 21:59:34 1148
原创 解决UILabel自动换行问题
解决UILabel自动换行问题设置:// 不以单词换行label.lineBreakMode = NSLineBreakByCharWrapping;
2022-03-30 11:58:25 1285
原创 xcode M1模拟器 报错
xcode M1模拟器 报错运行报错:1.building for iOS Simulator, but linking in object file built for iOS, for architecture arm642.The linked framework ‘Pods.framework’ is missing one or more architectures required by this target: arm64解决:1.Build Settings更改:2.podf
2022-03-15 22:46:49 4116
原创 推荐学习课程: 职场写作训练
推荐学习课程: 职场写作训练得到课程, 学了前5节课, 收获很大, 我一个文科学渣都慢慢对写作开窍了, 还有二十多节, 这周学完它.
2022-02-21 11:23:46 5986
原创 推荐电影: 东北虎, 甘草披萨
推荐电影: 东北虎, 甘草披萨东北虎:豆瓣评分不高, 但真的是个好电影.电影金句:伤感是没意义的.过了今天, 明天会是多么有意思.甘草披萨:神作, 支持两个人在一起的是共同经历与互相吸引.周末看的, 晚上都有高清资源了....
2022-02-21 09:38:42 112
原创 ios关联对象给UIView添加tapBlock
ios关联对象给UIView添加tapBlock#import "UIView+tap.h"#import <objc/runtime.h>static char kActionHandlerTapGestureKey;static char kActionHandlerTapBlockKey;@implementation UIView (tap)- (void)setTapWithBlock:(void(^)(void))block { UITapGestureRe
2022-02-17 17:27:32 1251
原创 ios获取类定义
ios获取类定义- (void)viewDidLoad { [super viewDidLoad]; // ios获取类定义 int numClasses; Class *classes = NULL; numClasses = objc_getClassList(NULL, 0); if (numClasses > 0) { classes = malloc(sizeof(Class) * numClasses); n
2022-02-17 00:09:51 105
原创 ios动态创建对象
ios动态创建对象- (void)viewDidLoad { [super viewDidLoad]; // 动态创建对象 id theObject = class_createInstance(NSString.class, sizeof(unsigned)); id str1 = [theObject init]; NSLog(@"%@", [str1 class]); id str2 = [[NSString alloc] initWithString
2022-02-17 00:04:01 1358
原创 ios类和对象操作函数
ios类和对象操作函数MyClass.h@interface MyClass : NSObject<NSCopying, NSCoding>@property (nonatomic, strong) NSArray *array;@property (nonatomic, copy) NSString *string;- (void)method1;- (void)method2;+ (void)classMethod1;@endMyClass.m@interface
2022-02-16 23:58:45 626
原创 meta class调试
meta class调试meta class是一个类对象的类,当向对象发消息,runtime会在这个对象所属类方法列表中查找发送消息对应的方法,但当向类发送消息时,runtime就会在这个类的meta class方法列表里查找。所有的meta class,包括Root class,Superclass,Subclass的isa都指向Root class的meta class,这样能够形成一个闭环。#import "ViewController.h"#import <objc/runtime.h&
2022-02-16 23:10:11 556
原创 房屋价格预测-数据分析(python)
房屋价格预测-数据分析(python)dataset download(https://c.d2l.ai/stanford-cs329p/assignments.html#assignment-1)import numpy as npimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsfrom IPython import displaydisplay.set_matplotlib_formats('sv
2022-02-11 23:34:41 2037
原创 UIScrollView 拖拽滑动时收起键盘
UIScrollView 拖拽滑动时收起键盘// 方法1- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { [[[UIApplication sharedApplication] keyWindow] endEditing:YES];}// 方法2self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;...
2022-02-01 10:45:59 1536
原创 如何快速定位哪个 View 出现了约束警告
如何快速定位哪个 View 出现了约束警告点击xcode的Debuy View Hierarchy, 然后把出错内存地址贴到右边底部搜索栏, 就可以定位到是具体那个view了.
2022-02-01 10:05:03 1441
原创 ios千分位和小数精度位数处理
ios千分位和小数精度位数处理- (NSString *)formatDecimalNumber:(NSString *)string { if (!string || string.length == 0) { return string; } NSNumber *number = @([string doubleValue]); NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]
2022-01-31 21:39:07 670
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人