iOS - 给WKWebView添加头、尾视图 #import "ViewController.h"#import <WebKit/WebKit.h>@interface ViewController ()/// web@property (nonatomic, strong) WKWebView *webView;/// view@property (nonatomic, strong) UIView *bottomView;@end@implementation ViewController- (void).
iOS - 暗黑模式图片、颜色的适配 1、图片的适配以一张图片,图片名字为1为例拖进工程后,选中该图片,展开右侧边栏,把appearances属性展开,选中Any,Dark把对应图片拖进去,适配完成2、颜色的适配// MARK: - 颜色的适配,可以封装成工具类或者宏- (UIColor *)obtainCurrentBGColor { if (@available(iOS 13, *)) { UIColor *currentColor = [UIColor colorWithDyna
iOS - 循环滚动公告栏的实现 封装了一个继承于UIView的类,如下:#import <UIKit/UIKit.h>NS_ASSUME_NONNULL_BEGIN@interface XtayNoticeScrollView : UIView- (instancetype)initWithFrame:(CGRect)frame titleArray:(NSArray<NSString *> *)titleArray;- (void)openTimer; - (void)cl
iOS - UTC日期和本地时间互转 // MARK: - 将本地时间转换为UTC时间- (NSString *)obtainUTCDateStringWithLocalDateString:(NSString *)localTimeString { NSDateFormatter *format = [[NSDateFormatter alloc] init]; format.dateFormat = @"yyyy-MM-dd HH:mm:ss"; format.timeZone = [NSTimeZone loc.
Mac - 加密压缩文件(免费) 1、打开终端2、键入 cd desktop 让终端控制桌面3、键入zip -er 【压缩后文件名】.zip 【源文件(含后缀名)】命令4、执行压缩命令,输入加密密码,确认加密密码5桌面出现压缩后的文件6、完成...
iOS - 用代码批量改变文件夹中文件的名字 NSString *path = @"/Users/zhangjinjiang/Desktop/ios"; NSFileManager *fileManager = [NSFileManager defaultManager]; // 创建一个新的文件夹路径 [fileManager createDirectoryAtPath:@"/Users/zhangjinjiang/Desktop/ios111" attributes:nil]; if ([fileManager f.
iOS - iOS 12 之后的归档(NSKeyedArchiver)、解档(NSKeyedUnarchiver)用法 一、iOS 12之后旧的归档解档方法废弃了,更改为:归档:+ (nullable NSData *)archivedDataWithRootObject:(id)object requiringSecureCoding:(BOOL)requiresSecureCoding error:(NSError **)error解档:+ (nullable id)unarchivedObjectOfClasses:(NSSet<Class> *)classes fromData:(N.
iOS - 检测是否被抓包 - (BOOL)checkProxySetting { NSDictionary *proxySettings = (__bridge NSDictionary *)(CFNetworkCopySystemProxySettings()); NSArray *proxies = (__bridge NSArray *)(CFNetworkCopyProxiesForURL((__bridge CFURLRef _Nonnull)([NSURL URLWithString:@"https:/.
MBProgressHUD的小封装 就是XtayMBHudView 这个类:#import <UIKit/UIKit.h>NS_ASSUME_NONNULL_BEGIN@interface XtayMBHudView : UIView/// 单例+ (instancetype)sharedSingleInstance;- (void)creatTextHudAlertViewWithSuperView:(UIView *)superView title:(NSString *)title detailT..
iOS - UIBezierPath 实现饼状图 首先看效果图:#import <UIKit/UIKit.h>NS_ASSUME_NONNULL_BEGIN@interface CircleView : UIView@property (nonatomic, copy) NSArray<NSNumber *> *valueArray;@endNS_ASSUME_NONNULL_END//...
iOS - 判断类的几种形式 1.创建类@interface Father : NSObject@end@interface Son : Father@end2.设置全局变量@interface ViewController () { Son *_s; Father *_f;} _f = [Father new]; _s = [Son new];下面开始判...
iOS - 自定义结构体 我一直在模仿,还未曾超越大神们......新建一个类,导入#import <UIKit/UIKit.h>框架,创建结构体:#import <UIKit/UIKit.h>typedef struct { int totalCount; int bestCount;}ZJJFriends;typedef struct { int...
iOS - 找出汉字拼音首字母 #import <Foundation/Foundation.h>@interface NSString (PinyinInitials)/**获取汉字拼音的首字母, 返回的字母是大写形式, 例如: @"俺妹", 返回 @"A".*如果字符串开头不是汉字, 而是字母, 则直接返回该字母, 例如: @"b彩票", 返回 @"B".*如果字符串开头不是...
iOS - 富文本指定文字点击实现(仿超链接) #import "ViewController.h"@interface ViewController () <UITextViewDelegate>@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loa...
iOS - 网址超链接 代码如下,直接跳转:- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSString *str1 = @"我是一只丑小鸭"; NSString *str2 = @"http://www...
iOS - 常用通用宏定义 #define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height// iPhone 机型(尺寸大小)判断#define IPHONE_SE