-
-
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 | |
} | |
} | |
ITsarik22
commented
Feb 27, 2023
•
I'm getting a Thread1: breakpoint 1.6 (1) any guidance on how to fix it?
I couldn't even prompt the imageliteral code, it's not exactly same as what showed on the tutorial. Anyone knows what code to type? Running on Xcode 14.3.1
@nobalking you can use like below
diceImageViewOne.image = UIImage(imageLiteralResourceName:"DiceSix");
I couldn't even prompt the imageliteral code, it's not exactly same as what showed on the tutorial. Anyone knows what code to type? Running on Xcode 14.3.1
@nobalking you are correct! i also experienced your problem. I think the problem was as a result of the newer version of xcode you are using, since it is newer than the one Angela used in the tutorial.
The real code should be diceImageView1.image = #imageLiteral()
You can also find more answers to your problems using stackoverflow.com. I hope this will help!
was great until i started the Alpha step , green background took over everything !?
@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.
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
}
}
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 :)
//
// 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
}
}
Screen.Recording.2024-11-09.at.6.17.31.AM.mov
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()
}
}