Commit 9589b1b9 authored by David黄金龙's avatar David黄金龙

1、日志输出

2、首页添加相应资源
parent fc65b59e
......@@ -287,9 +287,9 @@
A5ACE8D72B4564F7002C94D2 /* Classes */ = {
isa = PBXGroup;
children = (
A5ACE91B2B4564F7002C94D2 /* Modules */,
A5ACE91E2B4564F7002C94D2 /* Base */,
A5ACE8EE2B4564F7002C94D2 /* Tools */,
A5ACE91B2B4564F7002C94D2 /* Modules */,
);
path = Classes;
sourceTree = "<group>";
......
......@@ -107,10 +107,6 @@ extension AppDelegate {
}
YHNetworkStatusManager.shared.listenNetWorkStatus()
}
//1.设置主窗口
......
......@@ -37,7 +37,9 @@ class YHBaseViewController: UIViewController {
}
deinit {
#if DEBUG
print(#function)
// print(type(of: self))
// print("执行了方法:",terminator: "\t")
printLog(#function)
#endif
}
}
......
......@@ -17,6 +17,13 @@ class YHHomeViewController: YHBaseViewController {
return YHHomePageViewModel()
}()
lazy var headBkgImagV: UIImageView = {
let imagV = UIImageView()
imagV.image = UIImage(named: "home_head_bkg")
imagV.contentMode = .scaleAspectFill
return imagV
}()
override func viewDidLoad() {
super.viewDidLoad()
......@@ -52,8 +59,18 @@ class YHHomeViewController: YHBaseViewController {
}
private func initView()->Void {
navigationItem.title = "首页"
navigationItem.title = ""
view.backgroundColor = UIColor(hex:0xE9E9E9)
view.addSubview(headBkgImagV)
headBkgImagV.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(307)
}
}
}
......@@ -30,7 +30,7 @@ extension YHHomePageViewModel {
return
}
self.subject.onNext(YHHomeCofigMode())
print("model 是 ==>",model)
printLog("model 是 ==> \(model)")
} failBlock: { err in
print(err)
}
......
......@@ -187,14 +187,3 @@ extension String {
}
}
/// 打印
///
/// - Parameters:
/// - message: 打印内容
/// - file: 所在文件
/// - method: 所在方法
/// - line: 所在行
public func printLog<T>(_ message: T, file: String = #file, method: String = #function, line: Int = #line) {
print("\n[文件]:\((file as NSString).lastPathComponent) [所在行]:\(line),[方法名称]:\(method),[具体信息]:\(message)")
}
......@@ -12,14 +12,20 @@ import UIKit
let APP_NAME = Bundle.main.infoDictionary!["CFBundleName"] as! String
func YHLOG<T>(message:T,file:String = #file,funcName:String = #function,lineName:Int = #line){
//这个DEBUG 是一个debug时候的一个flag需要自己去xcode设置项设置。
/// 打印
///
/// - Parameters:
/// - message: 打印内容
/// - file: 所在文件
/// - method: 所在方法
/// - line: 所在行
public func printLog<T>(_ message: T, file: String = #file, method: String = #function, line: Int = #line) {
#if DEBUG
let flieName = (file as NSString).lastPathComponent
print("\(APP_NAME)/\(flieName)/\(funcName)/\(lineName):\(message)")
print("\n开始一段日志输出=========>\n[文件]:\((file as NSString).lastPathComponent)\n[所在行]:\(line)\n[方法名称]:\(method)\n[打印信息]:\(message)\n结束该段日志输出<=========\n\n\n")
#endif
}
///屏幕宽度
let KScreenWidth = UIScreen.main.bounds.size.width
///屏幕高度
......
......@@ -106,7 +106,7 @@ class YHNetRequest: NSObject {
httpRequest?.responseString(completionHandler: { string in
#if DEBUG
print("\n网络请求已返回 string=\(string)")
printLog("\n网络请求已返回 string=\(string)")
#endif
self.completeHandle(string: string)
})
......@@ -207,12 +207,12 @@ class YHNetRequest: NSObject {
extension YHNetRequest {
class func getRequest(url:String, params:[String:Any] = [:], successBlock: SuccessHandlerType!, failBlock: FailureHandlerType!) -> Request? {
YHLOG(message:"\n发起请求的URL是===> url = \(url)")
printLog("\n发起请求的URL是===> url = \(url)")
return YHNetRequest().url(url).requestType(.get).success(successBlock).failed(failBlock).startRequest()
}
class func postRequest(url:String, params:[String:Any] = [:], successBlock: SuccessHandlerType!, failBlock: FailureHandlerType!) -> Request? {
YHLOG(message:"\n发起请求的URL是===> url = \(url)")
printLog("\n发起请求的URL是===> url = \(url)")
return YHNetRequest().url(url).requestType(.post).success(successBlock).failed(failBlock).startRequest()
}
}
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "Rectangle 8235.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Rectangle 8235@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Rectangle 8235@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment