Giter Site home page Giter Site logo

coconutkit's Introduction

Passionate iOS and tvOS developer since 2010, I focus on crafting delightful and robust applications targeting Apple devices.

  • 🇨🇭 I am currently working at RTS (Radio Télévision Suisse), which is part of the SRG SSR (Swiss Broadcasting Corporation).
  • 📽 I am contributing to Pillarbox, the next-generation SRG SSR player ecosystem. The Apple implementation introduces a modern, fully reactive and SwiftUI-friendly approach to media playback on Apple platforms. In other words I know AVFoundation, AVKit, SwiftUI and Combine pretty well.
  • 👷 I was a main contributor for the Play SRG platform, which is how the SRG SSR and all its business units (RSI, RTR, RTS, SRF and SWI) provide public access to the audio and video content they publish.
  • 🧑‍💻 I nowadays write code in Swift, though I still enjoy some Objective-C from time to time.
  • 📚 I currently write iOS and tvOS apps using a combination of SwiftUI and UIKit for user interface work, with the help of Combine and reactive programming to drive user interface updates.
  • 🧰 I enjoy creating SDKs with simple, expressive and well documented APIs.
  • 💡 I share my knowledge through in-depth technical articles I publish on my blog.
  • 👀 Wanna have a look at the code I write? Then check the repositories of the application and player) I am working on, they are public!
  • ⬅️ Wanna get in touch? Then check the links on the left!

coconutkit's People

Contributors

0xced avatar defagos avatar goff-marocchi avatar j0ris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coconutkit's Issues

iOS 13 support

iOS 13 support should be quite straightforward. Testing the demo I still spotted a few issues:

  • UIStepper bindings do not work anymore.

I also found other issues not related to iOS 13:

  • Parallax demos are broken.
  • Linking with CoconutKit and MAKVONotificationCenter reveals category method conflicts (newly reported by Xcode 11).
  • Using the cursor resizing sliders make the demo crash.

ContainerStack popAll crash

line 288
NSUInteger index = firstRemovedIndex - 1 - i;//when firstRemovedIndex is 0,index will be very large.
so that line 289 will be out of range.

Crash on ViewController Lifecycle when running an app with a 3rd party keyboard

Hi,

I have found an issue when using CoconutKit with a device having a 3rd party keyboard installed.

It crashes in UIViewController+HLSExtensions.m when keyboard is going to appear.
Found the issue using master branch (commit: 0332e94)

Exception
static void swizzle_viewDidLoad(UIViewController *self, SEL _cmd)
{
if (! [self isViewLoaded]) {
@throw [NSException exceptionWithName:NSInternalInconsistencyException
reason:@"The view controller's view has not been loaded"
userInfo:nil];
}

Stacktrace
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The view controller's view has not been loaded'

Last Exception Backtrace:
0 CoreFoundation 0x00000001852242d8 exceptionPreprocess + 132
1 libobjc.A.dylib 0x0000000196ef80e4 objc_exception_throw + 56
2 Jobs 0x000000010029afe8 swizzled_UIViewController__viewDidLoad_Imp (UIViewController+HLSExtensions.m:244)
3 UIKit 0x0000000189c9cc18 -[UIViewController loadViewIfRequired] + 688
4 UIKit 0x0000000189c9c928 -[UIViewController view] + 28
5 UIKit 0x000000018a2c4164 -[_UIRemoteInputViewController viewDidInvalidateIntrinsicContentSize] + 20
6 libdispatch.dylib 0x0000000197575994 _dispatch_call_block_and_release + 20
7 libdispatch.dylib 0x0000000197575954 _dispatch_client_callout + 12
8 libdispatch.dylib 0x000000019757a20c _dispatch_main_queue_callback_4CF + 1604
9 CoreFoundation 0x00000001851db7f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
+ 8
10 CoreFoundation 0x00000001851d98a0 __CFRunLoopRun + 1488
11 CoreFoundation 0x00000001851052d4 CFRunLoopRunSpecific + 392
12 GraphicsServices 0x000000018eb5b6fc GSEventRunModal + 164
13 UIKit 0x0000000189d02f40 UIApplicationMain + 1484

Thanks.

Adding CoconutKit project to my workspace

I'm trying to convert a small demo project that uses version 1.1.3 of the static framework to a project that uses the CoconutKit sources directly. I created an empty workspace, added my project and the CoconutKit project to it, added the libCoconutKit.a library to the application link phase and added "CoconutKit/CoconutKit/**" to the User Header Search Paths.

The first problem was that the global import of <CoconutKit/CoconutKit.h> no longer works — it seems like this file is generated automatically.

I tried adding everything from the CoconutKit-dev-Prefix.pch to my own prefix file, and my application now builds and runs, but crashes immediately with an uncaught exception:

'NSInvalidArgumentException', reason: '-[LifeCycleTestViewController className]: unrecognized selector sent to instance 0x896cd90'

Is this a completely wrong approach, or is there some small detail I need to add?

Missing resources

Trying to build project checked out from github, build fails for demo, and kit itself:

error: /Users/roman/Projects/CoconutKit/CoconutKit-demo/../../../../../../LeStudioSDK/Binaries/CoconutKit/CoconutKit-1.0-Release.staticframework/Resources/CoconutKit_ButtonBarArrowLeft.png: No such file or directory
error: /Users/roman/Projects/CoconutKit/CoconutKit-demo/../../../../../../LeStudioSDK/Binaries/CoconutKit/CoconutKit-1.0-Release.staticframework/Resources/[email protected]: No such file or directory

Stackoverflow in "swizzle_viewDidLoad" when using custom keyboards

Steps to reproduce:

  1. Install on device custom keyboard (Yandex.keyboard or Rainbowkey for example)
  2. Create plain project in xcode, setup coconutkit as pod.
  3. Add simple UITextView on main screen
  4. Launch application and try to enter text in textview with custom keyboard
  5. Crash

Guess:
Swizzled "viewDidLoad" method called for UIRemoteViewController when actual view is nil. Calling "self.view.bounds.size" cause system to force load view and call viewDidLoad again and so on.

CocoaPod for 2.0.x

I need the ability to debug CoconutKit code in order to find out why the code below returns nil to me. I'm using version 2.0.1 (binary). But there is no such version of library in CocoaPods and no easy way to include sources in my project. Any suggestions? Maybe you could tell me why the following doesn't work:

    HLSModelManager *modelManager =
            [HLSModelManager SQLiteManagerWithModelFileName:@"CoreDataDb"
                                              configuration:nil
                                             storeDirectory:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]
                                                    options:HLSModelManagerLightweightMigrationOptions];

modelManager remains nil after that.

UPD. Although modelManager is nil, I can see the database file in user documents directory.

Crash with objc_msgSend() selector name: scrollViewDidScroll: in UIScrollView+HLSExtensions.m

Hard to reproduce, but got errors in live app

Here is crash thread

Application Specific Information:
objc_msgSend() selector name: scrollViewDidScroll:

Thread 0 Crashed:
0 libobjc.A.dylib 0x39775b26 objc_msgSend + 6
1 UIKit 0x3191912d -[UIScrollView(UIScrollViewInternal) _notifyDidScroll] + 62
2 UIKit 0x31695b7d -[UIScrollView setContentOffset:] + 594
3 AwesomeApp 0x00471ee9 swizzled_UIScrollView__setContentOffset_Imp (UIScrollView+HLSExtensions.m:143)
4 UIKit 0x31819e85 -[UIAnimator(Static) _advanceAnimationsOfType:withTimestamp:] + 258
5 UIKit 0x31819d7d -[UIAnimator(Static) _LCDHeartbeatCallback:] + 50
6 QuartzCore 0x3134d9cf CA::Display::DisplayLinkItem::dispatch() + 96
7 QuartzCore 0x3134d779 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 342
8 IOMobileFramebuffer 0x33f5476d IOMobileFramebufferVsyncNotifyFunc + 102
9 IOKit 0x2fbe5a75 IODispatchCalloutFromCFMessage + 246
10 CoreFoundation 0x2eec3e21 __CFMachPortPerform + 134
11 CoreFoundation 0x2eece9df CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 32
12 CoreFoundation 0x2eece97b __CFRunLoopDoSource1 + 344
13 CoreFoundation 0x2eecd14f __CFRunLoopRun + 1396
14 CoreFoundation 0x2ee37c27 CFRunLoopRunSpecific + 520
15 CoreFoundation 0x2ee37a0b CFRunLoopRunInMode + 104
16 GraphicsServices 0x33b38283 GSEventRunModal + 136
17 UIKit 0x316db049 UIApplicationMain + 1134
18 AwesomeApp 0x000b4e3f main (main.m:22)
19 libdyld.dylib 0x39c82ab7 start + 0

viewWillAppear and related methods not invoked when running from an archive

Hi Samuel,

I'm having a strange problem with CoconutKit: my application works fine on my iPad when I run it directly from Xcode, but when I create a Release archive and package it into a signed .ipa, the application no longer works correctly.

The problem seems to be that several UIViewController methods (viewWillAppear, viewDidAppear, viewWillDisappear and viewDidDisappear) are not invoked when the app runs from the signed ipa. This is what the device console shows when loading a lifecycle controller into a placeholder container:

(-[LifeCycleTestViewController viewDidLoad]) - Called for object <LifeCycleTestViewController: 0x1cda30>
(-[LifeCycleTestViewController shouldAutorotateToInterfaceOrientation:]) - Called, toInterfaceOrientation = UIInterfaceOrientationLandscapeLeft
(-[LifeCycleTestViewController shouldAutorotateToInterfaceOrientation:]) - Called, toInterfaceOrientation = UIInterfaceOrientationLandscapeLeft

In contrast to this, when I run the application on my iPad directly from Xcode, I see the following in the Xcode console:

(-[LifeCycleTestViewController viewDidLoad]) - Called for object <LifeCycleTestViewController: 0x194700>
(-[LifeCycleTestViewController shouldAutorotateToInterfaceOrientation:]) - Called, toInterfaceOrientation = UIInterfaceOrientationPortrait
(-[LifeCycleTestViewController shouldAutorotateToInterfaceOrientation:]) - Called, toInterfaceOrientation = UIInterfaceOrientationPortrait
(-[LifeCycleTestViewController viewWillDisappear:]) - Called for object <LifeCycleTestViewController: 0x177ec0>, animated = YES
(-[LifeCycleTestViewController viewWillAppear:]) - Called for object <LifeCycleTestViewController: 0x194700>, animated = YES
(-[LifeCycleTestViewController viewDidDisappear:]) - Called for object <LifeCycleTestViewController: 0x177ec0>, animated = YES
(-[LifeCycleTestViewController viewDidAppear:]) - Called for object <LifeCycleTestViewController: 0x194700>, animated = YES

I'm having this problem with a simple demo application that illustrates how to use the HLSPlaceholderViewController with a segment control to load LifecycleTestViewControllers (https://github.com/olifante/SegmentContainer).

Do you have any idea what the problem is? What am I doing wrong?

Thanks,

Tiago

Double calls viewWillAppear/viewDidAppear on iOS5

Environment: Xcode 4.2, iOS SDK 5.0, iPad 5.0 Simulator, CoconutKit 1.1.1

Steps for reproducing:

  1. start CoconutKit-dev in iPad Simulator;
  2. select HLSPlaceholderViewController;
  3. tap "Hide with modal"
  4. tap "Close" in appeared modal controller.

Actual result: two pairs viewWillAppear/viewDidAppear.
Expected result: one viewWillAppear and one viewDidAppear.

2012-02-16 16:49:41.008 CoconutKit-dev[14824:15203] [INFO] (-[LifeCycleTestViewController viewWillDisappear:]) - Called for object <LifeCycleTestViewController: 0x8b37770>, animated = YES
2012-02-16 16:49:41.412 CoconutKit-dev[14824:15203] [INFO] (-[LifeCycleTestViewController viewDidDisappear:]) - Called for object <LifeCycleTestViewController: 0x8b37770>, animated = YES
2012-02-16 16:50:03.485 CoconutKit-dev[14824:15203] [INFO] (-[LifeCycleTestViewController shouldAutorotateToInterfaceOrientation:]) - Called, toInterfaceOrientation = UIInterfaceOrientationPortrait
2012-02-16 16:50:03.486 CoconutKit-dev[14824:15203] [INFO] (-[HLSContainerContent addViewToContainerView:inContainerContentStack:]) - View controller's view already added to a container view
2012-02-16 16:50:03.487 CoconutKit-dev[14824:15203] [INFO] (-[LifeCycleTestViewController viewWillAppear:]) - Called for object <LifeCycleTestViewController: 0x8b37770>, animated = YES
2012-02-16 16:50:03.488 CoconutKit-dev[14824:15203] [INFO] (-[LifeCycleTestViewController viewWillAppear:]) - Called for object <LifeCycleTestViewController: 0x8b37770>, animated = YES
2012-02-16 16:50:03.491 CoconutKit-dev[14824:15203] [INFO] (-[LifeCycleTestViewController viewDidAppear:]) - Called for object <LifeCycleTestViewController: 0x8b37770>, animated = YES
2012-02-16 16:50:03.891 CoconutKit-dev[14824:15203] [INFO] (-[LifeCycleTestViewController viewDidAppear:]) - Called for object <LifeCycleTestViewController: 0x8b37770>, animated = YES

Issues with text views in scrollviews when an external keyboard is connected (iOS 9)

Starting with iOS 9, an external keyboard might reduce the software keyboard to it associated input accessory view. In this case the will hide notification is not called, the will show notification is called instead. This was not the case with iOS 8.

When editing a text view located within a scroll view with avoidingKeyboard = YES, CoconutKit therefore does not correctly update the insets when an external keyboard is connected. Input is still reduced to the area occupied by the full software keyboard when it was visible.

Slow email validation regex

The email validation regex becomes increasingly slow as the length of the string to validate increases (with no @ sign). It must probably be replaced / updated.

Make demos iPhone friendly

Currently the demos have been written for iPad, but CoconutKit is meant to be used with iPhone applications as well. Make the demo project iPhone friendly so that CoconutKit components can be easily tested on an iPhone as well.

Demo missing a file or two?

error: /LeStudioSDK/Binaries/CoconutKit/CoconutKit-1.1.4-Release.staticframework/CoconutKit-resources.bundle: No such file or directory

make-fmwk.sh is missing

When I build CoconutKit-demo, I get a Shell Script Invocation Error because the shell script is simply not there. I forked and downloaded the code today.

[Support Question] Navigation stack with bar

I'm taking a look through CoconutKit, very nice work :)

Take this situation:
I have a UINavigationController with some VCs to have a custom push/pop animation.

Is there a way I can use HLSStackController and use the built in UINavigationBar? At the moment it seems like you'd have to:

  • Use HLSStackController to act as the replacement UINavigationController
  • Create a custom subclass of HLSPlaceholderViewController as a new base class, to create 2 areas: 1 for the VC content, 1 for the custom navigationBar.
  • Whenever you wish to show a new screen, you create a new Placeholder and add the VC. The custom navigationBar is added automagically.

Thanks!

Cannot install with latest pods

MacBook-Pro-Ivan:Source ivangolub$ pod install
Analyzing dependencies
Downloading dependencies
Installing CoconutKit 2.0.2 (was 2.0.2)
[!] /bin/bash
set -e
echo "This Pod relies on the removed pre_install or post_install hooks and therefore will no longer continue to work. Please try updating to the latest version of this Pod or updating the Pod specification. See http://blog.cocoapods.org/CocoaPods-Trunk/ for more details." && exit 1

This Pod relies on the removed pre_install or post_install hooks and therefore will no longer continue to work. Please try updating to the latest version of this Pod or updating the Pod specification. See http://blog.cocoapods.org/CocoaPods-Trunk/ for more details.

Build fails with static framework > 1.0.1

I tried following the instructions in Samuel's video (http://vimeo.com/27618429), but just adding any version of the CoconutKit static framework from 1.1 to 1.1.3 causes the build to fail. The linker fails with multiple "Undefined symbol" errors:

Undefined symbols for architecture i386:
"_CATransform3DIsAffine", referenced from:
-[HLSAnimation playStep:animated:] in CoconutKit(HLSAnimation.o)
"_CATransform3DGetAffineTransform", referenced from:
-[HLSAnimation playStep:animated:] in CoconutKit(HLSAnimation.o)
"_CATransform3DInvert", referenced from:
-[HLSAnimation playStep:animated:] in CoconutKit(HLSAnimation.o)
-[HLSViewAnimationStep reverseViewAnimationStep] in CoconutKit(HLSViewAnimationStep.o)
"_CATransform3DIdentity", referenced from:
-[HLSViewAnimationStep init] in CoconutKit(HLSViewAnimationStep.o)
"OBJC_CLASS$_NSAttributeDescription", referenced from:
objc-class-ref in CoconutKit(HLSManagedTextFieldValidator.o)
"OBJC_CLASS$_NSManagedObjectModel", referenced from:
objc-class-ref in CoconutKit(HLSModelManager.o)
"OBJC_CLASS$_NSPersistentStoreCoordinator", referenced from:
objc-class-ref in CoconutKit(HLSModelManager.o)
"OBJC_CLASS$_NSManagedObjectContext", referenced from:
objc-class-ref in CoconutKit(HLSModelManager.o)
"_NSInferMappingModelAutomaticallyOption", referenced from:
-[HLSModelManager persistentStoreCoordinatorForManagedObjectModel:modelFileName:storeDirectory:] in CoconutKit(HLSModelManager.o)
"_NSMigratePersistentStoresAutomaticallyOption", referenced from:
-[HLSModelManager persistentStoreCoordinatorForManagedObjectModel:modelFileName:storeDirectory:] in CoconutKit(HLSModelManager.o)
"_NSSQLiteStoreType", referenced from:
-[HLSModelManager persistentStoreCoordinatorForManagedObjectModel:modelFileName:storeDirectory:] in CoconutKit(HLSModelManager.o)
"OBJC_CLASS$_NSEntityDescription", referenced from:
objc-class-ref in CoconutKit(NSManagedObject+HLSExtensions.o)
"OBJC_CLASS$_NSFetchRequest", referenced from:
objc-class-ref in CoconutKit(NSManagedObject+HLSExtensions.o)
"OBJC_CLASS$NSManagedObject", referenced from:
objc-class-ref in CoconutKit(NSManagedObject+HLSExtensions.o)
l_OBJC
$CATEGORY_NSManagedObject$HLSExtensions in CoconutKit(NSManagedObject+HLSExtensions.o)
objc-class-ref in CoconutKit(NSManagedObject+HLSValidation.o)
l_OBJC
$CATEGORY_NSManagedObject$HLSValidationPrivate in CoconutKit(NSManagedObject+HLSValidation.o)
l_OBJC
$CATEGORY_NSManagedObject$_HLSValidation in CoconutKit(NSManagedObject+HLSValidation.o)
(maybe you meant: OBJC_CLASS$_NSManagedObjectHLSValidation_Linker, OBJC_CLASS$_NSManagedObjectHLSExtensions_Linker )
"_NSDetailedErrorsKey", referenced from:
+[NSManagedObject(HLSValidationPrivate) combineError:withError:] in CoconutKit(NSManagedObject+HLSValidation.o)
+[NSManagedObject(HLSValidationPrivate) flattenHiearchyForError:] in CoconutKit(NSManagedObject+HLSValidation.o)
"_CATransform3DMakeTranslation", referenced from:
-[HLSKenBurnsSlideshow animationForImageView:withScaleFactor:xOffset:yOffset:] in CoconutKit(HLSKenBurnsSlideshow.o)
-[HLSKenBurnsSlideshow playNextImageAnimation] in CoconutKit(HLSKenBurnsSlideshow.o)
-[HLSAnimation playStep:animated:] in CoconutKit(HLSAnimation.o)
"_CATransform3DMakeScale", referenced from:
-[HLSKenBurnsSlideshow animationForImageView:withScaleFactor:xOffset:yOffset:] in CoconutKit(HLSKenBurnsSlideshow.o)
-[HLSKenBurnsSlideshow playNextImageAnimation] in CoconutKit(HLSKenBurnsSlideshow.o)
"_CATransform3DConcat", referenced from:
-[HLSKenBurnsSlideshow animationForImageView:withScaleFactor:xOffset:yOffset:] in CoconutKit(HLSKenBurnsSlideshow.o)
-[HLSKenBurnsSlideshow playNextImageAnimation] in CoconutKit(HLSKenBurnsSlideshow.o)
-[HLSAnimation playStep:animated:] in CoconutKit(HLSAnimation.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This happens both building for the simulator (as shown above) and for the native device. I'm using Xcode 4.3.2 on OS X 10.7.3.

Using version 1.0.1 does not produce these errors.

CoconutKit uses deprecated rotation calls in iOS 8

I know that they have just been deprecated in iOS 8, but I am beginning a substantial new project, and am concerned about long-term reliance on CoconutKit.
Do you have plans to update CoconutKit to use - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator ?

Browser top and bottom insets incorrect (especially since iOS 11)

The top and bottom browser insets are incorrect:

  • Starting with iOS 11, and depending on viewfit-cover (see this article), the behavior needs to be adjusted differently. Check with www.apple.com, for example.
  • The bottom toolbar covers the content (it does not count in the safe area / layout guides).

Fixing these issues requires some modernization layout work (to deal with the many iOS 11 changes mostly). I already have implementations bits around, but they should be brought together first.

error: can't exec '/usr/bin/make' (No such file or directory)

I'm getting error:

error: can't exec '/usr/bin/make' (No such file or directory)

Trying to run any of the demos without success. I'm using XCode 4.5.2 with iPad 6.0 Simulator. Are there any special instructions to get the demo working?

Thank you so much for your time and efforts in sharing your work and knowledge.

HLSTextField doesn’t properly obey its delegate

Implement - (BOOL) textFieldShouldEndEditing:(UITextField *)textField to return NO in the delegate of a HLSTextField.

Expected result: the text field doesn’t resign its first responder status.

Actual result: the text field resigns its first responder status.

StackViewController removeViewControllerAtIndex issue

Hi!
when I remove several viewController from StackViewController by removeViewControllerAtIndex ,and set animated to YES,I will remove only one VC.
and set animated to NO, I will remove correctly.
is this a bug?
when animated,the stack was been locked,then I can not remove next VC,is this right?
----------update------------
useful log
2013-05-20 15:51:35.883 下厨房菜谱[9987:907] [DEBUG](-[XcfNavigationController removeViewControllerAtIndex:animated:]) - stack after remove (
"XcfProfileViewController: 0x1da8ab40>",
"XcfProfileViewController: 0x1da05a10>",
"XcfDishDetailViewController: 0x1dc4afe0>"
)
2013-05-20 15:51:35.884 下厨房菜谱[9987:907] [DEBUG](-[XcfNavigationController removeViewControllerAtIndex:animated:]) - navigation bar items after remove (
"UINavigationItem: 0x1da96fd0>",
"UINavigationItem: 0x1db73290>",
"UINavigationItem: 0x1dc4e5a0>"
)
2013-05-20 15:51:35.886 下厨房菜谱[9987:907] [DEBUG](-[XcfNavigationController removeViewController:animated:]) - will remove XcfDishDetailViewController: 0x1dc4afe0>
2013-05-20 15:51:35.890 下厨房菜谱[9987:907] [DEBUG](-[HLSAnimationStep addObjectAnimation:forObject:]) - No object to animated
2013-05-20 15:51:35.891 下厨房菜谱[9987:907] [DEBUG](-[HLSAnimationStep addObjectAnimation:forObject:]) - No object to animated
2013-05-20 15:51:35.893 下厨房菜谱[9987:907] [DEBUG](-[HLSAnimationStep addObjectAnimation:forObject:]) - No object to animated
2013-05-20 15:51:35.894 下厨房菜谱[9987:907] [DEBUG](-[HLSAnimationStep addObjectAnimation:forObject:]) - No object to animated
2013-05-20 15:51:35.896 下厨房菜谱[9987:907] [DEBUG](-[HLSUserInterfaceLock lock]) - Acquire UI lock
2013-05-20 15:51:35.897 下厨房菜谱[9987:907] [DEBUG](-[HLSViewController viewWillDisappear:]) - View controller XcfDishDetailViewController: 0x1dc4afe0>: view will disappear, animated = YES
2013-05-20 15:51:35.898 下厨房菜谱[9987:907] Umeng: (logPageView) XcfDishDetailViewController 10 seconds
2013-05-20 15:51:35.899 下厨房菜谱[9987:907] [DEBUG](-[HLSViewController viewWillAppear:]) - View controller XcfProfileViewController: 0x1da05a10>: view will appear, animated = YES
2013-05-20 15:51:35.900 下厨房菜谱[9987:907] [DEBUG](-[HLSViewController viewWillAppear:]) - View controller XcfProfileDishesViewController: 0x1db74c30>: view will appear, animated = YES
2013-05-20 15:51:35.902 下厨房菜谱[9987:907] [DEBUG](-[XcfNavigationController removeViewControllerAtIndex:animated:]) - stack after remove (
"XcfProfileViewController: 0x1da8ab40>",
"XcfProfileViewController: 0x1da05a10>",
"XcfDishDetailViewController: 0x1dc4afe0>"//this VC should be removed,but failed
)
2013-05-20 15:51:35.903 下厨房菜谱[9987:907] [DEBUG](-[XcfNavigationController removeViewControllerAtIndex:animated:]) - navigation bar items after remove (
"UINavigationItem: 0x1da96fd0>",
"UINavigationItem: 0x1db73290>"
)

Rotation bug with HLSStackController

If you rotate multiple times the underlying views of an HLSStackController will no longer transition correctly during a pop animation for pushfrom transition styles.

Repro steps on iPad:
Implement an HLSStackController

  1. Push a viewcontroller
  2. Rotate
  3. Pop viewcontroller
  4. Push viewcontroller
  5. Rotate
  6. Pop viewcontroller

This last pop will place the underlying view in the wrong place.

Can also repro by push, rotate, [rotate ..], pop.

The problem is that the root view's transform property is not adjusted properly when handling the frame adjustment for the rotation.

In HLSContainerContent's rotationAnimationForContainerContentStack:containerView:withDuration:

e.g.,
case HLSTransitionStylePushFromRight: {
CGFloat offset = CGRectGetWidth(fixedFrame) + -->> belowView.transform.tx <<-- ;
viewAnimationStep.transform = CATransform3DMakeTranslation(-offset, 0.f, 0.f);
break;
}

The view's transform property is used as part of the offset calculation for the rotation adjustment animation.

However,
In HLSAnimation's playStep:animated: method to apply the transform:

view.frame = CGRectApplyAffineTransform(view.frame, convTransform);

The transform is used to create a new frame for the view, but the views transform is left alone.

Thus, consider a view that has a portrait width of 650, and a landscape width of 900.

In portrait mode, you push a new view controller using the HLSStackController.

The root view now has a transform with a tx of -650 and an origin.x of -650

Now, the orientation is changed to landscape.

The root view's width is now 900. So, offset = 900 + (-650) = 250 in rotationAnimationForContainerContentStack:containerView:withDuration:

In playStep:animated:, this creates a new frame with an origin of -900 for the root view, which is correct. However, the root view's transform tx is still -650.

So if you rotate again to portrait, the view width is back to 650. Thus, the offset calculation is now offset = 650 + (-650) = 0. So in playStep:animated: no adjust will be performed on the frame and it will still be at -900. But since we're in portrait mode, when the top view is popped, the root view will only be brought in by 650, thus incorrectly positioning it.

I was able to fix the problem by changing
view.frame = CGRectApplyAffineTransform(view.frame, convTransform);

to

view.transform = CGAffineTransformConcat(view.transform, convTransform);

in playStep:animated:

This had the affect of both changing the frame and correctly updating the view's transform property so no matter how many times you rotate, the offset calculation will be correct.

Sometimes incorrect layout guides when pushing a view controller into a stack controller

Sometimes the top layout guide might not be correctly propagated to the child view controller.

After spending too much time investigating this issue (without real success), I stumbled upon the probable cause: before iOS 11, -addChildViewController: must be called after the child view controller view has been added to its parent container, so that layout guides are correctly propagated.

The issues seems to disappear with iOS 11 and the new safe area concept. It is probably not so relevant anymore to address it.

HLSTableViewController

We should probably write a HLSTableViewController which would basically be a UITableViewController with HLSViewController features.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.