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

1、修改版本号

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