Reputation: 302
I am using CSStickyHeaderFlowLayout for Parallax Header in Swift. Xcode 7 swift 2.0 .
I tested the github swift demo. The app crashed when segueing to another view controller. The log said:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'great1'
I also tested the github object-c demo code , segue works fine .
I found out the code below has the problem . it's in appDelegate.swift for the swift demo code in the repository . Does anyone know the solution keeping segue working while having stickyParallaxHeader like the pic below .
[]
[
]
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let stickyHeaderFlowLayout = CSStickyHeaderFlowLayout()
let collectionViewController = CollectionViewController(collectionViewLayout: stickyHeaderFlowLayout)
let window = UIWindow(frame: UIScreen.mainScreen().bounds)
window.rootViewController = collectionViewController
window.makeKeyAndVisible()
self.window = window
return true
}
below is the debug log .
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<collectionviewmapdemo.CollectionViewController: 0x7fdbdb01d600>) has no segue with identifier 'great1''
*** First throw call stack:
(
0 CoreFoundation 0x0000000108d50f65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000109116deb objc_exception_throw + 48
2 UIKit 0x0000000107919692 -[UIViewController shouldPerformSegueWithIdentifier:sender:] + 0
3 collectionviewmapdemo 0x00000001051a6ba7 _TFC25collectionviewmapdemo24CollectionViewController14collectionViewfS0_FTCSo16UICollectionView24didSelectItemAtIndexPathCSo11NSIndexPath_T_ + 135
4 collectionviewmapdemo 0x00000001051a6c2f _TToFC25collectionviewmapdemo24CollectionViewController14collectionViewfS0_FTCSo16UICollectionView24didSelectItemAtIndexPathCSo11NSIndexPath_T_ + 79
5 UIKit 0x0000000107f91eb0 -[UICollectionView _selectItemAtIndexPath:animated:scrollPosition:notifyDelegate:] + 701
6 UIKit 0x0000000107fb2d51 -[UICollectionView touchesEnded:withEvent:] + 574
7 UIKit 0x0000000107988663 forwardTouchMethod + 349
8 UIKit 0x000000010798872c -[UIResponder touchesEnded:withEvent:] + 49
9 UIKit 0x0000000107988663 forwardTouchMethod + 349
10 UIKit 0x000000010798872c -[UIResponder touchesEnded:withEvent:] + 49
11 UIKit 0x0000000107c3dca5 _UIGestureRecognizerUpdate + 10289
12 UIKit 0x00000001077f7592 -[UIWindow _sendGesturesForEvent:] + 1137
13 UIKit 0x00000001077f8681 -[UIWindow sendEvent:] + 849
14 UIKit 0x00000001077aa752 -[UIApplication sendEvent:] + 263
15 UIKit 0x0000000107785fcc _UIApplicationHandleEventQueue + 6693
16 CoreFoundation 0x0000000108c7d0a1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x0000000108c72fcc __CFRunLoopDoSources0 + 556
18 CoreFoundation 0x0000000108c72483 __CFRunLoopRun + 867
19 CoreFoundation 0x0000000108c71e98 CFRunLoopRunSpecific + 488
20 GraphicsServices 0x000000010b240ad2 GSEventRunModal + 161
21 UIKit 0x000000010778b676 UIApplicationMain + 171
22 collectionviewmapdemo 0x00000001051b555d main + 109
23 libdyld.dylib 0x0000000109c3f92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Upvotes: 0
Views: 238
Reputation: 302
I finally sort it out .
Remove the above code from project, keep
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { return true }
CSStickyHeaderFlowLayout
, see the image below . Upvotes: 1