Closed chlebta closed 8 years ago
I'm trying to use it with swift project here's my code :
// MARK: - // MARK: UITableView Delegate extension LastEpisodesViewController: UITableViewDelegate { func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { let mangaDetailsVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("mangaDetailsVC"); self.navigationController?.pushViewController(mangaDetailsVC, animated: true); } } // MARK: - // MARK: UINavigationControllerDelegate extension LastEpisodesViewController : UINavigationControllerDelegate { func navigationController(navigationController: UINavigationController, animationControllerForOperation operation: UINavigationControllerOperation, fromViewController fromVC: UIViewController, toViewController toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { let type = (fromVC == self) ? ZOTransitionType.Presenting : ZOTransitionType.Dismissing; //get selected cell let cell = self.tableView.cellForRowAtIndexPath(self.tableView.indexPathForSelectedRow!) as! DefaultTableViewCell; let zoomTransition = ZOZolaZoomTransition(fromView: cell.coverImageView, type: type, duration: 0.5, delegate: self); return zoomTransition; } } // MARK: - // MARK: ZOZolaZoomTransitionDelegate extension LastEpisodesViewController : ZOZolaZoomTransitionDelegate{ func zolaZoomTransition(zoomTransition: ZOZolaZoomTransition!, startingFrameForView targetView: UIView!, relativeToView relativeView: UIView!, fromViewController: UIViewController!, toViewController: UIViewController!) -> CGRect { let cell = self.tableView.cellForRowAtIndexPath(self.tableView.indexPathForSelectedRow!) as! DefaultTableViewCell; if (fromViewController == self){ return (cell.imageView?.convertRect((cell.imageView?.bounds)!, toView: relativeView))!; } else if (fromViewController.isKindOfClass(MangaDetailsViewController)){ let mangaDetailsVC = fromViewController as! MangaDetailsViewController; return mangaDetailsVC.coverImageView.convertRect(mangaDetailsVC.coverImageView.bounds, toView: relativeView); } return CGRectZero; } func zolaZoomTransition(zoomTransition: ZOZolaZoomTransition!, finishingFrameForView targetView: UIView!, relativeToView relativeView: UIView!, fromViewController fromViewComtroller: UIViewController!, toViewController: UIViewController!) -> CGRect { let cell = self.tableView.cellForRowAtIndexPath(self.tableView.indexPathForSelectedRow!) as! DefaultTableViewCell; if (fromViewComtroller == self){ let mangaDetailsVC = toViewController as! MangaDetailsViewController return mangaDetailsVC.coverImageView.convertRect(mangaDetailsVC.coverImageView.bounds, toView: relativeView); } else if (fromViewComtroller.isKindOfClass(MangaDetailsViewController)){ return (cell.imageView?.convertRect((cell.imageView?.bounds)!, toView: relativeView))!; } return CGRectZero; } }
When I click on tableviewCell I get this error :
<UIImageView: 0x7fa7b3cfad90; frame = (0 0; 600 200); autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x7fa7b3c9acb0>> 2015-11-20 20:18:41.410 XAnime[21467:688455] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [nan nan; nan nan]' *** First throw call stack: ( 0 CoreFoundation 0x000000010a537f45 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000109fb1deb objc_exception_throw + 48 2 CoreFoundation 0x000000010a537e7d +[NSException raise:format:] + 205 3 QuartzCore 0x000000010ad99718 _ZN2CA5Layer10set_boundsERKNS_4RectEb + 226 4 QuartzCore 0x000000010ad999a9 -[CALayer setBounds:] + 154 5 QuartzCore 0x000000010ad9a2b4 -[CALayer setFrame:] + 737 6 UIKit 0x000000010af83132 -[UIView(Geometry) setFrame:] + 356 7 UIKit 0x000000010afa0992 -[_UIReplicantView setFrame:] + 167 8 ZOZolaZoomTransition 0x0000000109b30323 __42-[ZOZolaZoomTransition animateTransition:]_block_invoke + 595 9 UIKit 0x000000010af90dc8 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 582 10 UIKit 0x000000010af911fd +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] + 105 11 ZOZolaZoomTransition 0x0000000109b2ebac -[ZOZolaZoomTransition animateTransition:] + 4620 12 UIKit 0x000000010b0af5c0 -[UINavigationController _startCustomTransition:] + 4156 13 UIKit 0x000000010b0becdb -[UINavigationController _startDeferredTransitionIfNeeded:] + 712 14 UIKit 0x000000010b0bfcea -[UINavigationController __viewWillLayoutSubviews] + 57 15 UIKit 0x000000010b265c85 -[UILayoutContainerView layoutSubviews] + 248 16 UIKit 0x000000010af9ae40 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 710 17 QuartzCore 0x000000010ada259a -[CALayer layoutSublayers] + 146 18 QuartzCore 0x000000010ad96e70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 19 QuartzCore 0x000000010ad96cee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 20 QuartzCore 0x000000010ad8b475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277 21 QuartzCore 0x000000010adb8c0a _ZN2CA11Transaction6commitEv + 486 22 UIKit 0x000000010af11216 _afterCACommitHandler + 174 23 CoreFoundation 0x000000010a463947 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 24 CoreFoundation 0x000000010a4638b7 __CFRunLoopDoObservers + 391 25 CoreFoundation 0x000000010a45950b __CFRunLoopRun + 1147 26 CoreFoundation 0x000000010a458e08 CFRunLoopRunSpecific + 488 27 GraphicsServices 0x000000010e2fead2 GSEventRunModal + 161 28 UIKit 0x000000010aee630d UIApplicationMain + 171 29 XAnime 0x00000001095a95ed main + 109 30 libdyld.dylib 0x000000010d81292d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException
I'm also seeing this crash. How did you solve @chlebta? @scalessec
I've opened a PR adding a NaN check: https://github.com/NewAmsterdamLabs/ZOZolaZoomTransition/pull/8
NaN
I'm trying to use it with swift project here's my code :
When I click on tableviewCell I get this error :