tabBar変数の指定がしたいです。
TabbarControllerのタブに
0と1の2つのタグをそれぞれにつけました。
ViewController に
mport UIKit class ViewController: UIViewController { @IBOutlet var FashionPic: UITabBarItem! 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. } } //ボタン押下時の呼び出しメソッド extension ViewController : UITabBarControllerDelegate { let tabBar // タブの選択を制御するデリゲートメソッド public func tabBarController(tabBarController: UITabBarController, shouldSelectViewController viewController: UIViewController) -> Bool { if(viewController.restorationIdentifier == "first") { let controllers = ViewController; let index = controllers!.indexOf(viewController); if(FashionSendController!.restorationIdentifier == "second") { let label = FashionSendController!.view.viewWithTag(10) as! UILabel; label.text = index == 0 ? "First View" : "Second View"; } self.FashionSendController([controllers![1] , controllers![0], controllers![2]], animated: false); self.tabBar.items![1].title = "Second"; self.tabBar.items![1].selectedImage = UIImage(named: "second"); self.tabBar.items![1].image = UIImage(named: "second"); self.tabBar.items![0].title = "First"; self.tabBar.items![0].selectedImage = UIImage(named: "first"); self.tabBar.items![0].image = UIImage(named: "first"); return false; } return true; } }
と書きました。
Extensions may not contain stored properties とエラーが出たのですが、
どのように0と1の2つのタグを指定したタグバーをここで指定すれば良いのかわかりません。
どのようにどのように書けば良いのでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。