すごく初心者な質問で申し訳ないですが教えていただければ嬉しいです。
Use of unresolved identifier 'targetView'というエラーが出てしまいます。
ネットで調べると、スペルミス等で起こるエラーと書いてありますが、スペルのミスは見つかりません。
targetViewにエラーが出て出てますがこの場合、何が原因で、具体的にどこを修正すればよろしいでしょうか?
よろしくお願いします。。
エラーが出た場所に⬅️をつけてあります。
import UIKit class ViewController: UIViewController { var counter = 0 @IBAction func move1(_ sender: Any) { counter = counter + 1 print(counter) if counter == 1{ self.performSegue(withIdentifier: "goSetting", sender: nil) counter = 0 } } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func tapStartButton(_ sender: Any) { //ビューの角を丸める処理をアニメーションで表現する let animation = CABasicAnimation(keyPath: "cornerRadius") animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionDefault) // 変更前の値は0 animation.fromValue = 0 // 変更後の値は20 animation.toValue = 20 // アニメーションの時間は1秒 animation.duration = 1 // アニメーションをレイヤーに追加する targetView.layer.add(animation, forKey: "cornerRadius") ⬅️ここ // 変更後も角丸を維持 targetView.layer.cornerRadius = 20 ⬅️ここ } }
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/10/26 09:44