2017-05-24 12 views
1

私はiOSSwift3のAndroidタブのようなタブで作業しています。iOSのAndroidのようなタブSwift

child1の 『「ストーリーボード()識別子 とビューコントローラが含まれていません』:キャッチされない例外により 「NSInvalidArgumentException」、理由がに

アプリを終了する - :私はXLPagerTabStrip成功したが、直面する問題をインストールしていますここ

は私のコードです: -

import UIKit 
import XLPagerTabStrip 
class ParentViewController: ButtonBarPagerTabStripViewController { 

let customPurpleColor = UIColor(red:0.13 , green : 0.03 , blue : 0.25 , alpha : 1.0) 
override func viewDidLoad() { 
    super.viewDidLoad() 
    // Do any additional setup after loading the view. 
    settings.style.buttonBarBackgroundColor = .white 
    settings.style.buttonBarItemBackgroundColor = .white 
    settings.style.selectedBarBackgroundColor = customPurpleColor 
    settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 14) 
    settings.style.selectedBarHeight = 1.0 
    settings.style.buttonBarMinimumLineSpacing = 0 
    settings.style.buttonBarItemTitleColor = .black 
    settings.style.buttonBarItemsShouldFillAvailiableWidth = true 
    settings.style.buttonBarLeftContentInset = 0 
    settings.style.buttonBarRightContentInset = 0 
    changeCurrentIndexProgressive = { [weak self] (oldCell : ButtonBarViewCell? , newCell : ButtonBarViewCell? 
     , progressPercentage: CGFloat, changeCurrentIndex : Bool , animated : Bool) -> Void in 
     guard changeCurrentIndex == true else {return} 
     oldCell?.label.textColor = .black 
     newCell?.label.textColor = self?.customPurpleColor 
     } 
} 
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { 
    let child_1 = UIStoryboard(name : "Main" , bundle : nil).instantiateViewController(withIdentifier: "child1") 
    let child_2 = UIStoryboard(name : "Main" , bundle : nil).instantiateViewController(withIdentifier: "child2") 
    return [child_1 , child_2] 
     } 
} 

ChildViewController1.swift: -

import UIKit 
import XLPagerTabStrip 


class ChildViewController1: UIViewController , IndicatorInfoProvider{ 
func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo { 
    return IndicatorInfo(title : "child1") 
} 
} 

ChildViewController2.swift: -

import UIKit 
import XLPagerTabStrip 

class ChildViewController2: UIViewController , IndicatorInfoProvider{ 
func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo { 
    return IndicatorInfo(title : "child1") 
} 
} 

私はMain.storyboardにbuttonBarViewにUIScrollViewcollectionViewを使用しています。なぜ私はこのエラーが発生する理由が得られないのですか?

+0

あなたはストーリーボードでのViewControllerの識別子を設定する必要が – Selvin

+1

質問に関連していないタグを使用しないでください。 – KKRocks

答えて

0

あなたは以下の通りのViewControllerの識別子を設定する必要があります。

enter image description here

+0

ストーリーボードIDをchild1に設定しましたが、同じエラーが表示されます –

+0

あなたのコードが壊れていますか? – KKRocks

+0

あなたの「child1」コントローラが実際に存在するストーリーボードは本当に「Main」ですか? –

関連する問題