Commit 6b055c94 authored by shenyong's avatar shenyong

fix bugs

parent 6ba308f8
...@@ -14,9 +14,9 @@ extension AppDelegate{ ...@@ -14,9 +14,9 @@ extension AppDelegate{
func setupDynamicShortcuts() { func setupDynamicShortcuts() {
let shortcutItem = UIApplicationShortcutItem( let shortcutItem = UIApplicationShortcutItem(
type: "com.app.phonemanager.iap.distance", type: "com.app.phonemanager.iap.distance",
localizedTitle: "Unlock Exclusive Discounts", localizedTitle: "Unlock Special Offers",
localizedSubtitle: "Your special offer is awaiting—don't miss this limited-time second chance benefit!", localizedSubtitle: "A Special Offer Just for You!🎁",
icon: UIApplicationShortcutIcon(templateImageName: ""), //UIApplicationShortcutIcon(systemImageName: "star.fill"), icon: UIApplicationShortcutIcon(), //UIApplicationShortcutIcon(templateImageName: "icon_gift_sa"), //UIApplicationShortcutIcon(systemImageName: "star.fill"),
userInfo: nil userInfo: nil
) )
UIApplication.shared.shortcutItems = [shortcutItem] UIApplication.shared.shortcutItems = [shortcutItem]
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "优惠图标@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "优惠图标@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -15,8 +15,11 @@ class PayDistanceViewController: UIViewController { ...@@ -15,8 +15,11 @@ class PayDistanceViewController: UIViewController {
var scrollView:UIScrollView! var scrollView:UIScrollView!
var dropImage:UIImageView! var dropImage:UIImageView!
var distanceL:UILabel!
var annual:UILabel!
var cancelLabel:UILabel!
var yearDistacePrice:UILabel! var yearDistacePrice:UILabel!
var offerImage:UIImageView!
var payBtn:UIButton! var payBtn:UIButton!
...@@ -46,7 +49,7 @@ class PayDistanceViewController: UIViewController { ...@@ -46,7 +49,7 @@ class PayDistanceViewController: UIViewController {
closeBtn.addTarget(self, action: #selector(payClose), for: .touchUpInside) closeBtn.addTarget(self, action: #selector(payClose), for: .touchUpInside)
scrollView.addSubview(closeBtn) scrollView.addSubview(closeBtn)
let offerImage = UIImageView() offerImage = UIImageView()
offerImage.image = UIImage.init(named: "iap_distance_offer") offerImage.image = UIImage.init(named: "iap_distance_offer")
scrollView.addSubview(offerImage) scrollView.addSubview(offerImage)
...@@ -56,14 +59,16 @@ class PayDistanceViewController: UIViewController { ...@@ -56,14 +59,16 @@ class PayDistanceViewController: UIViewController {
scrollView.addSubview(dropImage) scrollView.addSubview(dropImage)
let distanceL = UILabel() distanceL = UILabel()
distanceL.text = "50% Discount" distanceL.text = "50% Discount"
distanceL.textAlignment = .center
distanceL.font = UIFont.systemFont(ofSize: 40, weight: .semibold) distanceL.font = UIFont.systemFont(ofSize: 40, weight: .semibold)
distanceL.textColor = UIColor.colorWithHex(hexStr: "#111111") distanceL.textColor = UIColor.colorWithHex(hexStr: "#111111")
scrollView.addSubview(distanceL) scrollView.addSubview(distanceL)
let annual = UILabel() annual = UILabel()
annual.text = "Annual visit" annual.text = "Annual visit"
annual.textAlignment = .center
annual.font = UIFont.systemFont(ofSize: 18, weight: .semibold) annual.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
annual.textColor = UIColor.colorWithHex(hexStr: "#111111") annual.textColor = UIColor.colorWithHex(hexStr: "#111111")
scrollView.addSubview(annual) scrollView.addSubview(annual)
...@@ -72,12 +77,14 @@ class PayDistanceViewController: UIViewController { ...@@ -72,12 +77,14 @@ class PayDistanceViewController: UIViewController {
yearDistacePrice.font = UIFont.systemFont(ofSize: 14,weight: .semibold) yearDistacePrice.font = UIFont.systemFont(ofSize: 14,weight: .semibold)
yearDistacePrice.textColor = UIColor.colorWithHex(hexStr: "#111111") yearDistacePrice.textColor = UIColor.colorWithHex(hexStr: "#111111")
yearDistacePrice.text = ""//"$39.99 $19.99 / Year" yearDistacePrice.text = ""//"$39.99 $19.99 / Year"
yearDistacePrice.textAlignment = .center
scrollView.addSubview(yearDistacePrice) scrollView.addSubview(yearDistacePrice)
let cancelLabel = UILabel() cancelLabel = UILabel()
cancelLabel.font = UIFont.systemFont(ofSize: 12,weight: .semibold) cancelLabel.font = UIFont.systemFont(ofSize: 12,weight: .semibold)
cancelLabel.textColor = UIColor.colorWithHex(hexStr: "#0082FF") cancelLabel.textColor = UIColor.colorWithHex(hexStr: "#0082FF")
cancelLabel.text = "Cancel at any time" cancelLabel.text = "Cancel at any time"
cancelLabel.textAlignment = .center
scrollView.addSubview(cancelLabel) scrollView.addSubview(cancelLabel)
payBtn = UIButton() payBtn = UIButton()
...@@ -123,18 +130,18 @@ class PayDistanceViewController: UIViewController { ...@@ -123,18 +130,18 @@ class PayDistanceViewController: UIViewController {
make.size.equalTo(30) make.size.equalTo(30)
} }
offerImage.snp.makeConstraints { make in // offerImage.snp.makeConstraints { make in
make.centerX.equalToSuperview() // make.centerX.equalToSuperview()
make.top.equalTo(kSafeAreaInsets.top+70) // make.top.equalTo(kSafeAreaInsets.top+70)
make.width.equalTo(111) // make.width.equalTo(111)
make.height.equalTo(37) // make.height.equalTo(37)
} // }
//
distanceL.snp.makeConstraints { make in // distanceL.snp.makeConstraints { make in
make.centerX.equalToSuperview() // make.centerX.equalToSuperview()
make.top.equalTo(annual.snp.top).offset(-115.RH()) // make.top.equalTo(annual.snp.top).offset(-115.RH())
} // }
//
appleLabel.snp.makeConstraints { make in appleLabel.snp.makeConstraints { make in
...@@ -155,23 +162,23 @@ class PayDistanceViewController: UIViewController { ...@@ -155,23 +162,23 @@ class PayDistanceViewController: UIViewController {
make.bottom.equalTo(appleLabel.snp.top).offset(-24) make.bottom.equalTo(appleLabel.snp.top).offset(-24)
} }
cancelLabel.snp.makeConstraints { make in // cancelLabel.snp.makeConstraints { make in
make.centerX.equalToSuperview() // make.centerX.equalToSuperview()
make.bottom.equalTo(payBtn.snp.top).offset(-22) // make.bottom.equalTo(payBtn.snp.top).offset(-22)
make.height.equalTo(22) // make.height.equalTo(22)
} // }
//
yearDistacePrice.snp.makeConstraints { make in // yearDistacePrice.snp.makeConstraints { make in
make.centerX.equalToSuperview() // make.centerX.equalToSuperview()
make.bottom.equalTo(cancelLabel.snp.top).offset(0) // make.bottom.equalTo(cancelLabel.snp.top).offset(0)
make.height.equalTo(22) // make.height.equalTo(22)
} // }
//
annual.snp.makeConstraints { make in // annual.snp.makeConstraints { make in
make.centerX.equalToSuperview() // make.centerX.equalToSuperview()
make.bottom.equalTo(yearDistacePrice.snp.top).offset(-8) // make.bottom.equalTo(yearDistacePrice.snp.top).offset(-8)
make.height.equalTo(22) // make.height.equalTo(22)
} // }
scrollView.addSubview(termsView) scrollView.addSubview(termsView)
...@@ -218,21 +225,139 @@ class PayDistanceViewController: UIViewController { ...@@ -218,21 +225,139 @@ class PayDistanceViewController: UIViewController {
let dropW = CGFloat(300.RW()) let dropW = CGFloat(300.RW())
let dropH = CGFloat(224.RW()) let dropH = CGFloat(224.RW())
dropImage.frame = CGRect(x: (ScreenW - dropW) / 2, y: -dropH, width: dropW, height: dropH) // dropImage.frame = CGRect(x: (ScreenW - dropW) / 2, y: -dropH, width: dropW, height: dropH)
//
// offerImage.frame = CGRect(x: (ScreenW - 111) / 2, y: -37, width: 111, height: 37)
// distanceL.frame = CGRect(x: (ScreenW - 270) / 2, y: -40, width: 270, height: 40)
// annual.frame = CGRect(x: (ScreenW - 150) / 2, y: -30, width: 150, height: 22)
// yearDistacePrice.frame = CGRect(x: (ScreenW - 200) / 2, y: -30, width: 200, height: 22)
// cancelLabel.frame = CGRect(x: (ScreenW - 150) / 2, y: -30, width: 150, height: 22)
self.dropImage.frame = CGRect(x: (ScreenW - dropW)/2.0,
y: kSafeAreaInsets.top + 129.RH(), // 根据原来的约束位置计算
width: dropW,
height: dropH)
self.offerImage.frame = CGRect(x: (ScreenW - 111) / 2,
y: kSafeAreaInsets.top + 70,
width: 111,
height: 37)
self.distanceL.frame = CGRect(x: (ScreenW - 270) / 2,
y: kSafeAreaInsets.top + CGFloat(129.RH()) + dropH + CGFloat(40.RH()),
width: 270,
height: 40)
self.annual.frame = CGRect(x: (ScreenW - 150) / 2,
y: self.distanceL.frame.maxY + CGFloat(115.RH()),
width: 150,
height: 22)
self.yearDistacePrice.frame = CGRect(x: (ScreenW - 200) / 2,
y: self.annual.frame.maxY + 8,
width: 200,
height: 22)
self.cancelLabel.frame = CGRect(x: (ScreenW - 150) / 2,
y: self.yearDistacePrice.frame.maxY,
width: 150,
height: 22)
payBtn.alpha = 0
dropImage.alpha = 0
offerImage.alpha = 0
distanceL.alpha = 0
annual.alpha = 0
yearDistacePrice.alpha = 0
cancelLabel.alpha = 0
UIView.animate(withDuration: 1.1) {
self.payBtn.alpha = 1
self.dropImage.alpha = 1
self.offerImage.alpha = 1
self.distanceL.alpha = 1
self.annual.alpha = 1
self.yearDistacePrice.alpha = 1
self.cancelLabel.alpha = 1
}
// 添加重力动画效果 // 添加重力动画效果
UIView.animate(withDuration: 1.1, // UIView.animate(withDuration: 1.1,
delay: 0.2, // delay: 0.2,
usingSpringWithDamping: 0.5, // 弹性系数,越小弹性越大 // usingSpringWithDamping: 0.5, // 弹性系数,越小弹性越大
initialSpringVelocity: 0.8, // 初始速度 // initialSpringVelocity: 0.8, // 初始速度
options: .curveEaseIn, // options: .curveEaseIn,
animations: { // animations: {
// 设置最终位置 // // 设置最终位置
self.dropImage.frame = CGRect(x: (ScreenW - dropW)/2.0, // self.dropImage.frame = CGRect(x: (ScreenW - dropW)/2.0,
y: kSafeAreaInsets.top + 129.RH(), // 根据原来的约束位置计算 // y: kSafeAreaInsets.top + 129.RH(), // 根据原来的约束位置计算
width: dropW, // width: dropW,
height: dropH) // height: dropH)
}, completion: nil) //
// self.offerImage.frame = CGRect(x: (ScreenW - 111) / 2,
// y: kSafeAreaInsets.top + 70,
// width: 111,
// height: 37)
//
// self.distanceL.frame = CGRect(x: (ScreenW - 270) / 2,
// y: kSafeAreaInsets.top + CGFloat(129.RH()) + dropH + CGFloat(40.RH()),
// width: 270,
// height: 40)
//
// self.annual.frame = CGRect(x: (ScreenW - 150) / 2,
// y: self.distanceL.frame.maxY + CGFloat(115.RH()),
// width: 150,
// height: 22)
//
// self.yearDistacePrice.frame = CGRect(x: (ScreenW - 200) / 2,
// y: self.annual.frame.maxY + 8,
// width: 200,
// height: 22)
//
// self.cancelLabel.frame = CGRect(x: (ScreenW - 150) / 2,
// y: self.yearDistacePrice.frame.maxY,
// width: 150,
// height: 22)
// }, completion: nil)
// offerImage.frame = CGRect(x: (ScreenW - 111) / 2, y: -37, width: 111, height: 37)
// distanceL.frame = CGRect(x: (ScreenW - 270) / 2, y: -40, width: 270, height: 40)
// annual.frame = CGRect(x: (ScreenW - 150) / 2, y: -30, width: 150, height: 22)
// yearDistacePrice.frame = CGRect(x: (ScreenW - 200) / 2, y: -30, width: 200, height: 22)
// cancelLabel.frame = CGRect(x: (ScreenW - 150) / 2, y: -30, width: 150, height: 22)
//
// // 添加下落动画
// UIView.animate(withDuration: 0.3,
// delay: 0, // 稍微延迟一点,让动画错开
// options: .curveEaseOut) {
// // 设置最终位置
// self.offerImage.frame = CGRect(x: (ScreenW - 111) / 2,
// y: kSafeAreaInsets.top + 70,
// width: 111,
// height: 37)
//
// self.distanceL.frame = CGRect(x: (ScreenW - 270) / 2,
// y: kSafeAreaInsets.top + CGFloat(129.RH()) + dropH + CGFloat(40.RH()),
// width: 270,
// height: 40)
//
// self.annual.frame = CGRect(x: (ScreenW - 150) / 2,
// y: self.distanceL.frame.maxY + CGFloat(115.RH()),
// width: 150,
// height: 22)
//
// self.yearDistacePrice.frame = CGRect(x: (ScreenW - 200) / 2,
// y: self.annual.frame.maxY + 8,
// width: 200,
// height: 22)
//
// self.cancelLabel.frame = CGRect(x: (ScreenW - 150) / 2,
// y: self.yearDistacePrice.frame.maxY,
// width: 150,
// height: 22)
//
// }
// 添加呼吸动画 // 添加呼吸动画
......
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