前提・実現したいこと
レシピのアプリを作っていて、まず親クラス(TableViewController2)に食材名を入力していて、その子クラス(StepperController)にラベルと、stepperを接続したいのですが、stepperのAction接続はできますが、labelのOutlet接続をしても下記のエラーコードが出ます。
発生している問題・エラーメッセージ
The Label1 outlet from the StepperController to the UILabel is invalid. Outlets cannot be connected to repeating content.
該当の親クラスのソースコード
import UIKit class TableViewController2:UIViewController,UITableViewDelegate,UITableViewDataSource{ @IBOutlet var MyTV2: UITableView! let TODO2 = ["キャベツ","ジャガイモ","タマネギ","ニンジン","モヤシ","牛肉","豚肉","鶏肉"] override func viewDidLoad() { super.viewDidLoad() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return TODO2.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "cell2", for:indexPath) cell.textLabel?.text = TODO2[indexPath.row] return cell } }
該当の子クラスのソースコード
import UIKit class StepperController:TableViewController2{ @IBOutlet var Label1: UILabel! override func viewDidLoad() { super.viewDidLoad() } }
試したこと
Label1のcustom classの class名をStepperControllerと入力しましたができませんでした。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。