代码拉取完成,页面将自动刷新
同步操作将从 兰德网络O2OA平台软件/O2OA 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
//
// O2DemoAlertView.swift
// O2Platform
//
// Created by FancyLou on 2019/1/22.
// Copyright © 2019 zoneland. All rights reserved.
//
import UIKit
import CocoaLumberjack
class O2DemoAlertView: UIView {
let backFrame = CGRect.init(x: 0, y: 0, width: SCREEN_WIDTH, height: SCREEN_HEIGHT)
let backColor = UIColor(r: 0, g: 0, b: 0, a: 0.6)
var boardView = UIView()
var closeBtn = UIButton.init(type: UIButton.ButtonType.custom)
func initView() -> UIView {
self.frame = backFrame
self.isHidden = true
self.backgroundColor = backColor
return self
}
private func addBoardView() {
// 公告内容放到屏幕外面
let x = (SCREEN_WIDTH - 315 ) / 2
self.boardView.frame = CGRect.init(x: x, y: -(SCREEN_HEIGHT), width: 315, height: 485)
self.boardView.backgroundColor = UIColor.clear
let boardBackImage = UIImageView.init(frame: CGRect.init(x: 0, y: 0, width: 315, height: 485))
boardBackImage.layer.masksToBounds = true
boardBackImage.contentMode = UIView.ContentMode.scaleAspectFill
boardBackImage.image = UIImage(named: "pic_czsm")
self.boardView.addSubview(boardBackImage)//添加公告
let closeX = CGFloat(315 - 5 - 22)
self.closeBtn.frame = CGRect.init(x: closeX, y: 5, width: 22, height: 22) // 关闭按钮在公告的右上角 right:5 top:5
self.closeBtn.setImage(UIImage(named: "icon_off_white2"), for: UIControl.State.normal)
self.closeBtn.addTarget(self, action: #selector(closeAlertView), for: UIControl.Event.touchUpInside)
self.boardView.addSubview(self.closeBtn)
self.closeBtn.isHidden = true //关闭按钮隐藏
}
func showFallDown() {
UIApplication.shared.keyWindow?.addSubview(initView())
self.isHidden = false //显示背景
addBoardView() //添加公告
self.addSubview(self.boardView)
//执行动画 从上往下掉落 回弹一下
let firstY = SCREEN_HEIGHT - 485
let secondY = CGFloat(0.0)
let lastY = (SCREEN_HEIGHT - 485) / 2
UIView.animate(withDuration: 0.5, animations: {
self.boardView.frame.origin.y = firstY
}) { (_) in
UIView.animate(withDuration: 0.2, animations: {
self.boardView.frame.origin.y = secondY
}, completion: { (_) in
UIView.animate(withDuration: 0.2, animations: {
self.boardView.frame.origin.y = lastY
}, completion: { (_) in
self.closeBtn.isHidden = false
})
})
}
}
@objc func closeAlertView() {
self.closeBtn.isHidden = true
UIView.animate(withDuration: 0.5, animations: {
self.boardView.frame.origin.y = -(SCREEN_HEIGHT)
}) { (_) in
self.removeFromSuperview()
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。