setViewControllers(_:direction:animated:completion:)
のcompletionブロックにクロージャを渡して実行するとクラッシュします。
高さを変更したい特定のViewの中にはUITableViewが入っています
直し方をご存知でしたら教えて下さい。
swift
1// コードでPageViewControllerを指定ページに移動させる処理 2func movePageViewController(from: PageView?, to: PageView?, completion: ((Bool) -> Void)? = nil ) { 3 4 let sb = UIStoryboard(name: "TestVC", bundle: nil) 5 let vc = sb.instantiateInitialViewController() as! TestVC 6 7 let fromIndex: Int = from.rawValue 8 let toIndex: Int = to.rawValue 9 10 // animationDirection 11 let direction : UIPageViewController.NavigationDirection = fromIndex > toIndex ? .reverse : .forward 12 13 // presentViewController 14 subWindowPageViewController? 15 .setViewControllers([vc], direction: direction, animated: true, completion: completion) 16} 17 18// 呼び出し/ページ遷移後に特定Viewの高さを(アニメーション付きで)変える 19func testMove2(from: PageView?, to: PageView?) { 20 movePageViewController(from: PageView?, to: PageView?){ (finished) in 21 UIView.animate(withDuration:0.6, delay: 0.0, options: .curveEaseIn, animations: { 22 self.specifiedViewHieght.constant += 200 23 self.view.layoutIfNeeded() // <= ここでエラー 24 }, completion: nil) 25 } 26} 27
2020-01-05 12:16:25.217938+0900 tPageView[1812:171411] *** Assertion failure in -[_UIQueuingScrollView _replaceViews:updatingContents:adjustContentInsets:animated:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3899.22.15/_UIQueuingScrollView.m:395
2020-01-05 12:16:25.221600+0900 tPageView[1812:171411] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: [views count] == 3'
*** First throw call stack:
(
0 CoreFoundation 0x000000010cb1e1ee __exceptionPreprocess + 350
1 libobjc.A.dylib 0x000000010c98bb20 objc_exception_throw + 48
2 CoreFoundation 0x000000010cb1df68 +[NSException raise:format:arguments:] + 88
3 Foundation 0x000000010c3b3de9 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 UIKitCore 0x000000011587686a -[_UIQueuingScrollView _replaceViews:updatingContents:adjustContentInsets:animated:] + 948
5 UIKitCore 0x0000000115879e27 -[_UIQueuingScrollView _didScrollWithAnimation:force:] + 1143
6 UIKitCore 0x00000001158759c0 -[_UIQueuingScrollView _scrollViewAnimationEnded:finished:] + 89
7 UIKitCore 0x0000000115530883 -[UIAnimator stopAnimation:] + 377
8 UIKitCore 0x0000000115530f64 -[UIAnimator _advanceAnimationsOfType:withTimestamp:] + 268
9 QuartzCore 0x0000000113b86b66 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 640
10 QuartzCore 0x0000000113c5fac3 ZL22display_timer_callbackP12__CFMachPortPvlS1 + 299
11 CoreFoundation 0x000000010ca41e8d __CFMachPortPerform + 157
12 CoreFoundation 0x000000010ca819c9 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 41
13 CoreFoundation 0x000000010ca81028 __CFRunLoopDoSource1 + 472
14 CoreFoundation 0x000000010ca7bb64 __CFRunLoopRun + 2516
15 CoreFoundation 0x000000010ca7ae66 CFRunLoopRunSpecific + 438
16 GraphicsServices 0x000000010f998bb0 GSEventRunModal + 65
17 UIKitCore 0x0000000115f55dd0 UIApplicationMain + 1621
18 tPageView 0x000000010be2c9ab main + 75
19 libdyld.dylib 0x000000010f3b0d29 start + 1
20 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。