関数が呼ばれません。
TabBarControllerでTab1、2を押すと画面が切り替わるようにしたいのですが
それに関する
self.tabBarController!.setViewControllers([FashionSendController() , FashionViewController()], animated: false);
のコードが呼ばれません。
import UIKit import SwiftyJSON 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 { // タブの選択を制御するデリゲートメソッド public func tabBarController(tabBarController: UITabBarController, viewController: UIViewController) -> Bool { if(viewController.restorationIdentifier == "first") { self.tabBarController!.setViewControllers([FashionSendController() , FashionViewController()], animated: false); let items = self.tabBarController!.tabBar.items; items![1].title = "Second"; // items![1].selectedImage = UIImage(named: "second"); // items![1].image = UIImage(named: "second"); items![0].title = "First"; // items![0].selectedImage = UIImage(named: "first"); // items![0].image = UIImage(named: "first"); return false; } return true; } }
とViewController全体には書きました。
実行しTabBarのitems[1]を押すと
AppDelegateの
class AppDelegate: UIResponder, UIApplicationDelegate {
でsignal SIGABRTとエラーで落ちてしまいます。
どこを直せば良いのでしょうか?
あなたの回答
tips
プレビュー