PeterPan Swift HW_3 viewDidLoadCustom
Published in
Jun 23, 2021
Goal: Customize viewDidLoad startup
Step 1: Add Thanos gif in the begining
//Add Thanos gif into app
let thanosView = UIImageView(frame: CGRect(x: 40, y: 300, width: 300, height: 200))
view.addSubview(thanosView)
let thanosGif = UIImage.animatedImageNamed("thanosGif-", duration: 30)
thanosView.image = thanosGif
Step 2: Add Fist Mask on Thanos gif
//Add Fist Mask on Thanos gif
let maskImage = UIImage(named: "fistMask.png")
let maskImageView = UIImageView(image: maskImage)
thanosView.mask = maskImageView
Step 3: Add Night to the Background
//Add Night to the Background
let nightView = UIImageView(frame: CGRect(x: 0, y: 200, width: 400, height: 400))
let nightImage = UIImage(named: "night.jpg")
nightView.image = nightImage
nightView.alpha = 0.5
view.addSubview(nightView)
Step 4: Finished!