Skip to content

Instantly share code, notes, and snippets.

@angelabauer
Created August 13, 2019 11:57
Show Gist options
  • Save angelabauer/9d94ee98153b84681a63e7744077c9f0 to your computer and use it in GitHub Desktop.
Save angelabauer/9d94ee98153b84681a63e7744077c9f0 to your computer and use it in GitHub Desktop.
//
// ViewController.swift
// Dicee-iOS13
//
// Created by Angela Yu on 11/06/2019.
// Copyright © 2019 London App Brewery. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var diceImageView1: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
diceImageView1.image = #imageLiteral(resourceName: "DiceSix")
//Who What Value
diceImageView1.alpha = 0.5
}
}
@wellbegen
Copy link

was great until i started the Alpha step , green background took over everything !?

@Polyrhythmik
Copy link

@wellbegen In the document outline pane you can sort the layers of objects by dragging each object. It looks like you need to move the background image to the back so that the other objects are visible.

@ShriGaneshPurohit
Copy link

Screenshot 2023-10-09 at 8 12 52 PM

new challenge for rolling to dice 2 successfully completed!

@Ayushjhax
Copy link

image
Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value

i am getting this error

@Aadileb
Copy link

Aadileb commented Feb 7, 2024

can someone explain why its showing Five dots instead of four while doing opaq
Screenshot 2024-02-07 at 1 57 16 PM

@lilianaBasak
Copy link

Screenshot 2024-02-28 at 11 08 56 PM (2)
I'm trying to do this, but since the course is from 2019, it's not the same now, can someone show how they did it?

@Nandha2403
Copy link

Nandha2403 commented Apr 4, 2024

Screenshot 2024-04-04 at 4 46 15 PM
Haha

@Aryanmittal23
Copy link

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var diceImageView1: UIImageView!

/// <#Description#>
override func viewDidLoad() {
    super.viewDidLoad()
    
    diceImageView1.image = #imageLiteral(resourceName: "DiceSix")
    diceImageView1.alpha = 0.5
}

}

@Instamac2891
Copy link

class ViewController: UIViewController {

@IBOutlet weak var diceImageView1: UIImageView!

override func viewDidLoad() {
    super.viewDidLoad()
   
    diceImageView1.image = #imageLiteral(resourceName: "DiceSix")
   diceImageView1.layer.opacity = 0.5
}

It works :)

@hansblockchain
Copy link

//
// ViewController.swift
// Dicee-iOS13
//
// Created by Angela Yu on 11/06/2019.
// Copyright © 2019 London App Brewery. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var diceImageView1: UIImageView!

override func viewDidLoad() {
    super.viewDidLoad()
   
    diceImageView1.image = UIImage(imageLiteralResourceName: "DiceSix")
    diceImageView1.alpha = 0.5
}

}

@PolunLin
Copy link

image

@White1689
Copy link

Screenshot 2024-10-04 at 22 30 49 The course is a nice course but it needs to be updated because Xcode has been updated and some features have changed.

@kumailkhan123
Copy link

Screen.Recording.2024-11-09.at.6.17.31.AM.mov
Screenshot 2024-11-09 at 6 22 42 AM import UIKit

class ViewController: UIViewController, UIGestureRecognizerDelegate {
var imgeOne =

["DiceeLogo","DiceFive","DiceFour","DiceOne","DiceSix","DiceThree","DiceTwo","GreenBackground","DiceFive","DiceFour","DiceOne","DiceSix","DiceThree","DiceTwo","DiceFive","DiceFour","DiceOne","DiceSix","DiceThree","DiceTwo"
]
var tabtrr = true
@IBOutlet weak var immj: UIImageView!
@IBOutlet weak var imageView1: UIImageView!

@IBOutlet weak var imageViewT: UIImageView!
override func viewDidLoad() {
    super.viewDidLoad()
 
    khn22()
 

    }
func imagetab() {
     let uitabgesture = UITapGestureRecognizer(target: self, action: #selector(khan))
        imageView1.addGestureRecognizer(uitabgesture)
   
      
}
func  imagetb1(){
    let uitabgesture1 = UITapGestureRecognizer(target: self, action: #selector(khn1))
    imageViewT.addGestureRecognizer(uitabgesture1)
}
@objc func khan(){
    if let randomimage  = imgeOne.randomElement(){
        imageView1.image = UIImage(named: randomimage)
    }
    else{
        print("imageView1 nill")
    }
}
@objc func khn1(){
     if  let rdmimage1 = imgeOne.randomElement(){
         imageViewT.image = UIImage(named: rdmimage1)
    }
    else{
        print("imageViewTwo nil")
    }
}
@objc func khn22(){
    imagetab()
   imagetb1()
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment