// // LaunchViewController.swift // Twear // // Created by yangbin on 2021/12/29. // import UIKit class LaunchViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .white let imageView = UIImageView(frame: view.frame) imageView.image = UIImage(named: "launch_image") imageView.contentMode = .scaleAspectFit view.addSubview(imageView) // let size = LocString("立即体验").boundingRect(with: CGSize(width: 300, height: 30), options: .usesLineFragmentOrigin, attributes: [.font: RegularFont(15)], context: nil).size // let width = size.width+28 var bottomSpace = 0.0 if #available(iOS 11.0, *) { let window = UIApplication.shared.windows[0] let bottomPadding = window.safeAreaInsets.bottom bottomSpace = bottomPadding } let button = UIButton(frame: CGRect(x: SCREEN_WIDTH/2-184/2, y: SCREEN_HEIGHT-(80 + bottomSpace), width: 184, height: 52)) button.setColor(radio: 26, color: .rgbColorFromHex(0x24C789), borderColor: .clear, textColor: .white, text: LocString("立即体验")) button.addTarget(self, action: #selector(gotoHomeVC), for: .touchUpInside) button.titleLabel?.font = RegularFont(18) view.addSubview(button) } @objc private func gotoHomeVC() { KeyWindow.rootViewController = ZCTabBarController() KeyWindow.makeKeyAndVisible() } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }