Commit ce9c4382 authored by David黄金龙's avatar David黄金龙

1、修改版本号

2、处理按钮点击的bug
3、处理图片压缩的问题
parent 7b75a479
...@@ -2483,7 +2483,7 @@ ...@@ -2483,7 +2483,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 3; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
...@@ -2503,7 +2503,7 @@ ...@@ -2503,7 +2503,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 0.1.9; MARKETING_VERSION = 0.2.1;
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy; PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
...@@ -2525,7 +2525,7 @@ ...@@ -2525,7 +2525,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 3; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
...@@ -2545,7 +2545,7 @@ ...@@ -2545,7 +2545,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 0.1.9; MARKETING_VERSION = 0.2.1;
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy; PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
......
...@@ -41,8 +41,8 @@ class YHInformationFillTipsAlertView: UIView { ...@@ -41,8 +41,8 @@ class YHInformationFillTipsAlertView: UIView {
let tableView = UITableView(frame: .zero, style: .plain) let tableView = UITableView(frame: .zero, style: .plain)
tableView.backgroundColor = .clear tableView.backgroundColor = .clear
tableView.separatorStyle = .none tableView.separatorStyle = .none
tableView.showsHorizontalScrollIndicator = true tableView.showsHorizontalScrollIndicator = false
tableView.showsVerticalScrollIndicator = false tableView.showsVerticalScrollIndicator = true
tableView.rowHeight = UITableView.automaticDimension tableView.rowHeight = UITableView.automaticDimension
// tableView.estimatedRowHeight = 100 // tableView.estimatedRowHeight = 100
tableView.register(YHInformationFillTipsCell.self,forCellReuseIdentifier: YHInformationFillTipsCell.cellReuseIdentifier) tableView.register(YHInformationFillTipsCell.self,forCellReuseIdentifier: YHInformationFillTipsCell.cellReuseIdentifier)
...@@ -121,6 +121,7 @@ class YHInformationFillTipsAlertView: UIView { ...@@ -121,6 +121,7 @@ class YHInformationFillTipsAlertView: UIView {
let lable00 = UILabel(text: "我确认我所提供的材料真实有效,并知悉其中内容。") let lable00 = UILabel(text: "我确认我所提供的材料真实有效,并知悉其中内容。")
lable00.font = UIFont.PFSC_R(ofSize: 12) lable00.font = UIFont.PFSC_R(ofSize: 12)
lable00.textColor = UIColor.labelTextColor2 lable00.textColor = UIColor.labelTextColor2
...@@ -148,6 +149,7 @@ class YHInformationFillTipsAlertView: UIView { ...@@ -148,6 +149,7 @@ class YHInformationFillTipsAlertView: UIView {
make.height.width.equalTo(12) make.height.width.equalTo(12)
} }
agreeButton = selectedBtn agreeButton = selectedBtn
agreeButton.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
let topView = UIView() let topView = UIView()
......
...@@ -194,65 +194,59 @@ enum ImageCopmpressSize { ...@@ -194,65 +194,59 @@ enum ImageCopmpressSize {
} }
extension UIImage { //extension UIImage {
//我们的项目就定不大于200KB // func compressImage(size:ImageCopmpressSize) -> Data{
// func compressImage()->Data{ // switch size {
// compressImage(size: .two) // case .one:
// return compressImage(maxLength: 1024*100)
// case .two:
// return compressImage(maxLength: 1024*200)
// case .three:
// return compressImage(maxLength: 1024*300)
// case .four:
// return compressImage(maxLength: 4 * 1024 * 1024)
// }
// } // }
//
//
func compressImage(size:ImageCopmpressSize) -> Data{ // // 图片压缩 byte
switch size { // func compressImage(maxLength: Int) -> Data {
case .one: // // let tempMaxLength: Int = maxLength / 8
return compressImage(maxLength: 1024*100) // let tempMaxLength: Int = maxLength
case .two: // var compression: CGFloat = 1
return compressImage(maxLength: 1024*200) // guard var data = self.jpegData(compressionQuality: compression), data.count > tempMaxLength else { return self.jpegData(compressionQuality: compression)! }
case .three: //
return compressImage(maxLength: 1024*300) // // 压缩大小
case .four: // var max: CGFloat = 1
return compressImage(maxLength: 3 * 1024 * 1024) // var min: CGFloat = 0
} // for _ in 0..<6 {
} // compression = (max + min) / 2
// data = self.jpegData(compressionQuality: compression)!
// if CGFloat(data.count) < CGFloat(tempMaxLength) * 0.9 {
// 图片压缩 byte // min = compression
func compressImage(maxLength: Int) -> Data { // } else if data.count > tempMaxLength {
// let tempMaxLength: Int = maxLength / 8 // max = compression
let tempMaxLength: Int = maxLength // } else {
var compression: CGFloat = 1 // break
guard var data = self.jpegData(compressionQuality: compression), data.count > tempMaxLength else { return self.jpegData(compressionQuality: compression)! } // }
// }
// 压缩大小 // var resultImage: UIImage = UIImage(data: data)!
var max: CGFloat = 1 // if data.count < tempMaxLength { return data }
var min: CGFloat = 0 //
for _ in 0..<6 { // // 压缩大小
compression = (max + min) / 2 // var lastDataLength: Int = 0
data = self.jpegData(compressionQuality: compression)! // while data.count > tempMaxLength && data.count != lastDataLength {
if CGFloat(data.count) < CGFloat(tempMaxLength) * 0.9 { // lastDataLength = data.count
min = compression // let ratio: CGFloat = CGFloat(tempMaxLength) / CGFloat(data.count)
} else if data.count > tempMaxLength { // print("Ratio =", ratio)
max = compression // let size: CGSize = CGSize(width: Int(resultImage.size.width * sqrt(ratio)),
} else { // height: Int(resultImage.size.height * sqrt(ratio)))
break // UIGraphicsBeginImageContext(size)
} // resultImage.draw(in: CGRect(x: 0, y: 0, width: size.width, height: size.height))
} // resultImage = UIGraphicsGetImageFromCurrentImageContext()!
var resultImage: UIImage = UIImage(data: data)! // UIGraphicsEndImageContext()
if data.count < tempMaxLength { return data } // data = resultImage.jpegData(compressionQuality: compression)!
// }
// 压缩大小 // return data
var lastDataLength: Int = 0 // }
while data.count > tempMaxLength && data.count != lastDataLength { //}
lastDataLength = data.count
let ratio: CGFloat = CGFloat(tempMaxLength) / CGFloat(data.count)
print("Ratio =", ratio)
let size: CGSize = CGSize(width: Int(resultImage.size.width * sqrt(ratio)),
height: Int(resultImage.size.height * sqrt(ratio)))
UIGraphicsBeginImageContext(size)
resultImage.draw(in: CGRect(x: 0, y: 0, width: size.width, height: size.height))
resultImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
data = resultImage.jpegData(compressionQuality: compression)!
}
return data
}
}
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