1.UIWindow属性:
1>、- (void)becomeKeyWindow; // override point for subclass. Do not call directly 调用窗口,使之变成关键窗口
2>、- (void)resignKeyWindow; // override point for subclass. Do not call directly 调用窗口,使之取消关键窗口
3>、- (void)makeKeyWindow; 使之成为主窗口
4>、- (void)makeKeyAndVisible; // convenience. most apps call this to show the main window and also make it key. otherwise use view hidden property 使之成为主窗口,并且显示
5>、- (void)sendEvent:(UIEvent *)event; // called by UIApplication to dispatch events to views inside the window 事件拦截分发到指定视图对象
2.Swift-WKWebView与H5交互:
https://blog.csdn.net/pk_sir/article/details/74312211
https://www.cnblogs.com/xuzb/p/9018661.html
3.Xcode代码行数统计查询:
利用终端切换到对应的工程目录下:
每个文件行数:
find . -name "*.m" -or -name "*.h" -or -name "*.xib" -or -name "*.c" |xargs wc -l
总行数:
find . -name "*.m" -or -name "*.h" -or -name "*.xib" -or -name "*.c" |xargs grep -v "^$"|wc -l
4.沉浸式:
沉浸式是之前的安卓的,状态栏的颜色自动适应和导航栏颜色一样
那时候的安卓需要 安装xpose框架才能实现
这个概念的实际应用就是,页面延伸到状态栏,然后状态栏的颜色和页面上面颜色保持一致
5.循环引用:
http://www.cocoachina.com/ios/20170206/18629.html
// 弹出设置打印语言 let vc = PrintSettingController() vc.sureBillDetailType = sureBillDetailType vc.completed = { (bPrint, model) in self.bPrint = bPrint self.printModel = model sureWork() } self.popup(controller: vc, direction: .center)
vc引用了block,block里没有引用vc,所以不会循环引用.
6.正确使用Carthage:
https://www.jianshu.com/p/42118918177b
7. 不能Present控制器:
https://www.cnblogs.com/Rinpe/p/5669903.html
// 新加一个任务,addOperation添加任务到队列 OperationQueue.main.addOperation { self.popup(controller: vc, direction: .center) }
8. 防止present当前遮罩没有消失:可以设置延迟处理
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1, execute: { self.presentPrintSettingVC() })
9.String转NSNumber:
payType.money = NSNumber(value: Double(String.stringValue(textField.text).replacingOccurrences(of: ",", with: "") )!)
10.删除特定字符串:
str.replacingOccurrences(of: ",", with: "")
11.输入金额只能为数字或者小数点正则:
整数或者小数:
^[0-9]+([.][0-9]+){0,1}$