Skip to content

Commit

Permalink
nut: HLSStackController: Fixed many issues and crashes due to the new…
Browse files Browse the repository at this point in the history
… view depth parameter. Now works!
  • Loading branch information
defagos committed Aug 4, 2011
1 parent e165391 commit 95101de
Show file tree
Hide file tree
Showing 5 changed files with 474 additions and 580 deletions.
4 changes: 2 additions & 2 deletions nut-dev/nut-dev.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: le studio hortis (36HKZU4CJJ)";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand All @@ -1609,7 +1609,7 @@
INFOPLIST_FILE = "nut_dev-Info.plist";
OTHER_CFLAGS = "-DHLS_LOGGER";
PRODUCT_NAME = "nut-dev";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "826F178B-1B43-454E-AF7C-4D1ED1DB62CF";
};
name = Debug;
};
Expand Down
70 changes: 28 additions & 42 deletions nut/Sources/ViewControllers/HLSContainerContent.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
* View controllers inserted into view controller containers exhibit common properties:
* - they belong to a container, which they must be able to identify, and they should not be inserted into several
* containers at the same time
* - they are displayed using some transition style, and might be stretched to fill the view when the container
* displayed them
* - a view controller's view must be created lazily at the time it is really required
* - they are added and removed using some transition style, and might be stretched to fill the container's view
* where they are displayed
* - a view controller's view should be created lazily at the time it is really required
* - it must be possible to pre-load a view controller container before it gets actually displayed
* - a view controller container must retain the view controllers it manages
* - a view controller's view properties should be restored when it is removed from a container. It might namely
* happen that a client caches this view controller for later reuse
* - in general, we want to restrict user interaction to the most recently view controller inserted into a container
* - we sometimes may want the view controller container to forward some properties of a contained view controller
* (e.g. title, navigation elements, toolbar, etc.) transparently
* The HLSContainerContent class provides a way to ensure that those common properties can be fulfilled. It can be seen
* as some kind of smart pointer object, taking ownership of a view controller inserted into a view controller
* container.
* The HLSContainerContent class provides a way to ensure that those common properties can be easily implemented. It
* can be seen as some kind of smart pointer object, taking ownership of a view controller when inserted into a view
* controller container.
*
* When implementing a view controller container, use HLSContainerContent objects (retained by the container) to take
* ownership of a view controller when it is inserted, and simply release the HLSContainerContent object when the view
* controller gets removed from the container. When interacting with the view controller, use the HLSContainerContent
* object as a proxy to help you guarantee that the common properties listed above are fulfulled.
* object as a proxy to help you guarantee that the common properties listed above are fulfilled.
*
* Designated initializer: initWithViewController:containerController:transitionStyle:duration:
*/
Expand All @@ -42,7 +42,6 @@
HLSTransitionStyle m_transitionStyle;
NSTimeInterval m_duration;
BOOL m_viewControllerContainerForwardingEnabled;
HLSAnimation *m_cachedAnimation;
CGRect m_originalViewFrame;
CGFloat m_originalViewAlpha;
}
Expand All @@ -63,10 +62,23 @@
transitionStyle:(HLSTransitionStyle)transitionStyle
duration:(NSTimeInterval)duration;

/**
* Same as above, using the default transition animation duration
*/
- (id)initWithViewController:(UIViewController *)viewController
containerController:(id)containerController
transitionStyle:(HLSTransitionStyle)transitionStyle;

/**
* Instantiate and add the view controller's view as subview of a view managed by the container controller (the view in
* which it displays its content). If blockInteraction is set to YES, a transparent stretchable view is inserted below
* the view controller's view to prevent interaction with other views below.
*
* Some view controller containers might display several view controllers simultaneously in the same content view. In
* such cases, the corresponding stack of container content objects can be provided (the receiver must be part of it).
* This allows the view to be inserted at the proper location in the view hierarchy. If this parameter is nil, the
* view is simply added on top.
* The first element in the stack array is interpreted as the bottommost one.
*
* If the stretch boolean is set to YES, the view controller's view is stretched to fill the whole container view.
* How this happens depends on the view controller's view autoresizing mask.
Expand All @@ -75,20 +87,8 @@
*/
- (BOOL)addViewToContainerView:(UIView *)containerView
stretch:(BOOL)stretch
blockInteraction:(BOOL)blockInteraction;

/**
* Same as addViewToContainerView:stretch:blockInteraction, but inserting the view below / above the view of another
* container content (which must of course belong to the same container)
*/
- (BOOL)insertViewIntoContainerView:(UIView *)containerView
belowContainerContent:(HLSContainerContent *)containerContent
stretch:(BOOL)stretch
blockInteraction:(BOOL)blockInteraction;
- (BOOL)insertViewIntoContainerView:(UIView *)containerView
aboveContainerContent:(HLSContainerContent *)containerContent
stretch:(BOOL)stretch
blockInteraction:(BOOL)blockInteraction;
blockInteraction:(BOOL)blockInteraction
inContainerContentStack:(NSArray *)containerContentStack;

/**
* Remove the view controller's view from the container view
Expand All @@ -109,31 +109,17 @@
- (void)releaseViews;

/**
* Create and cache an animation which displays the view controller using the defined transition style and duration.
* You can provide an array of other container contents (i.e. view controllers) to be hidden during the animation.
* The commonFrame parameter is the frame where all animation take place (usually the view in which the container draws
* the view controllers it manages).
* Create the animation needed to display the view controller's view in the container view. If the receiver is part
* of a container content stack, the stack can be supplied as parameter so that the animation can be tailored
* accordingly.
*
* The created animation is cached internally. This is required if you need to play the reverse animation when removing
* the view controller from the container (reverseAnimation method). If the container view changes, the cached animation
* will most probably not be correct anymore. In such cases, you need to call this method again so that the animation
* can be updated appropriately (e.g. during a rotation of the interface).
* The first element in the stack array is interpreted as the bottommost one.
*
* The animation returned by this method has default properties. You usually want to tweak some of them (e.g. delegate,
* tag, etc.) right after creation.
*
* Note that there is an accessor for the reverse animation, but not for the cached animation. This was made on purpose.
* The reason is that the animation must be created at the very last moment, when we are sure that the frame dimensions
* of the involved views are known. Having no access to the cached animation enforces this good practice by forcing the
* user to create the animation where she needs it.
*/
- (HLSAnimation *)createAnimationWithDisappearingContainerContents:(NSArray *)disappearingContainerContents
commonFrame:(CGRect)commonFrame;

/**
* Return the reverse animation (if an animation was created), nil otherwise
*/
- (HLSAnimation *)reverseAnimation;
- (HLSAnimation *)animationWithContainerContentStack:(NSArray *)containerContentStack
containerView:(UIView *)containerView;

/**
* The attached view controller. If you need to access its view, do not use the UIViewController view property
Expand Down
Loading

0 comments on commit 95101de

Please sign in to comment.