コード全文
Swift4.0
1import UIKit 2import Tabman 3import Pageboy 4 5class TabViewController: TabmanViewController,PageboyViewControllerDataSource, TMBarDataSource { 6 7 func barItem(for bar: TMBar, at index: Int) -> TMBarItemable { 8 return viewControllers[2] as! TMBarItemable 9 } 10 11 func numberOfViewControllers(in pageboyViewController: PageboyViewController) -> Int { 12 return viewControllers.count 13 } 14 15 func viewController(for pageboyViewController: PageboyViewController, 16 at index: PageboyViewController.PageIndex) -> UIViewController? { 17 return viewControllers[index] 18 } 19 20 func defaultPage(for pageboyViewController: PageboyViewController) -> PageboyViewController.Page? { 21 return nil 22 } 23 24 func barItem(for tabViewController: TabmanViewController, at index: Int) -> TMBarItemable { 25 let title = "Page (index)" 26 return TMBarItem(title: title) 27 } 28 29 private var viewControllers = [ViewController1(), UIViewController2(),UIViewController3()] 30 31 override func viewDidLoad() { 32 super.viewDidLoad() 33 34 self.dataSource = self 35 36 // Create bar 37 let bar = TMBar.ButtonBar() 38 bar.layout.transitionStyle = .snap // Customize 39 40 // Add to view 41 addBar(bar, dataSource: self, at: .top) 42 } 43} 44
実現したいことは「Tabman」と言われるモジュールで画面を切り替えるページングメニューバーを作ることです。
以下の公式の手順通りに現在開発を進めています。(英語です)
https://uias.github.io/Tabman/master/index.html
画面構成は自分でview controllersを配置してセグエでTabViewControllerからそれぞれ繋げて構成してみました。
初歩的・大雑把な質問で申し訳ございません。
解決に繋がりそうなアドバイスなどなんでもお待ちしています。
ぜひご教授願い致しますm(_ _)m
8/1 追記 掲載されたプロジェクトを参考に進めましたが、AppDelegateでエラーが発生
8/3 追記 コンソールのメッセージ
2019-08-03 02:12:38.319389+0900 tabbar[63029:2060250] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'Main' in bundle NSBundle </Users/tomoya/Library/Developer/CoreSimulator/Devices/A5979362-CDD8-43C7-887C-D00D530C75C1/data/Containers/Bundle/Application/32D75E3C-A0CA-4FB9-9CAA-C2B997081DA6/tabbar.app> (loaded)' *** First throw call stack: ( 0 CoreFoundation 0x00000001108381bb __exceptionPreprocess + 331 1 libobjc.A.dylib 0x000000010f2ed735 objc_exception_throw + 48 2 UIKitCore 0x00000001153df27a +[UIStoryboard storyboardWithName:bundle:] + 676 3 UIKitCore 0x000000011523e016 -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 76 4 UIKitCore 0x000000011523e50c -[UIApplication _loadMainInterfaceFile] + 272 5 UIKitCore 0x000000011523cb25 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1357 6 UIKitCore 0x0000000114a5b4e9 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866 7 UIKitCore 0x0000000114a6429c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153 8 UIKitCore 0x0000000114a5b126 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233 9 UIKitCore 0x0000000114a5bae0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085 10 UIKitCore 0x0000000114a59cb5 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 795 11 UIKitCore 0x0000000114a5995f -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435 12 UIKitCore 0x0000000114a5ea90 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 584 13 UIKitCore 0x0000000114a5f80e _performActionsWithDelayForTransitionContext + 100 14 UIKitCore 0x0000000114a5e7ef -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 221 15 UIKitCore 0x0000000114a6393a -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392 16 UIKitCore 0x000000011523b44e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515 17 UIKitCore 0x0000000114ddfd09 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357 18 FrontBoardServices 0x000000011b0dc2da -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448 19 FrontBoardServices 0x000000011b0e7443 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271 20 FrontBoardServices 0x000000011b0e6b3a __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53 21 libdispatch.dylib 0x00000001128f2602 _dispatch_client_callout + 8 22 libdispatch.dylib 0x00000001128f5b78 _dispatch_block_invoke_direct + 301 23 FrontBoardServices 0x000000011b11bba8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30 24 FrontBoardServices 0x000000011b11b860 -[FBSSerialQueue _performNext] + 457 25 FrontBoardServices 0x000000011b11be40 -[FBSSerialQueue _performNextFromRunLoopSource] + 45 26 CoreFoundation 0x000000011079d721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 27 CoreFoundation 0x000000011079cf93 __CFRunLoopDoSources0 + 243 28 CoreFoundation 0x000000011079763f __CFRunLoopRun + 1263 29 CoreFoundation 0x0000000110796e11 CFRunLoopRunSpecific + 625 30 GraphicsServices 0x0000000118e451dd GSEventRunModal + 62 31 UIKitCore 0x000000011523e81d UIApplicationMain + 140 32 tabbar 0x000000010e7b8467 main + 71 33 libdyld.dylib 0x0000000112968575 start + 1 34 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/08/01 05:25
2019/08/01 05:37
2019/08/01 13:08 編集
2019/08/01 14:18
2019/08/02 11:25
2019/08/02 17:33