Skip to content

Commit

Permalink
ViewDeckController will now compile (and work) with GCC 4.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Inferis committed Feb 8, 2012
1 parent 6d9f5b0 commit fa0580e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
7 changes: 6 additions & 1 deletion ViewDeck/IIViewDeckController.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ typedef enum {
#define IIViewDeckCenterHiddenIsInteractive(interactivity) ((interactivity) == IIViewDeckCenterHiddenUserInteractive)


@interface IIViewDeckController : UIViewController
@interface IIViewDeckController : UIViewController {
@private
CGFloat _panOrigin;
BOOL _viewAppeared;
CGFloat _preRotationWidth, _leftWidth, _rightWidth;
}

@property (nonatomic, retain) id<IIViewDeckControllerDelegate> delegate;
@property (nonatomic, retain) UIViewController* centerController;
Expand Down
12 changes: 4 additions & 8 deletions ViewDeck/IIViewDeckController.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@
#define OPEN_SLIDE_DURATION(animated) SLIDE_DURATION(animated,DURATION_FAST)
#define CLOSE_SLIDE_DURATION(animated) SLIDE_DURATION(animated,DURATION_SLOW)

@interface IIViewDeckController () <UIGestureRecognizerDelegate> {
CGFloat _panOrigin;
BOOL _viewAppeared;
CGFloat _preRotationWidth, _leftWidth, _rightWidth;
}
@interface IIViewDeckController () <UIGestureRecognizerDelegate>

@property (nonatomic, retain) UIView* referenceView;
@property (nonatomic, readonly) CGRect referenceBounds;
Expand Down Expand Up @@ -925,17 +921,17 @@ - (void)removePanners {
- (BOOL)checkDelegate:(SEL)selector animated:(BOOL)animated {
BOOL ok = YES;
if (self.delegate && [self.delegate respondsToSelector:selector])
ok = ok & (BOOL)objc_msgSend(self.delegate, selector, self, animated);
ok = ok & (BOOL)(int)objc_msgSend(self.delegate, selector, self, animated);

for (UIViewController* controller in self.controllers) {
// check controller first
if ([controller respondsToSelector:selector])
ok = ok & (BOOL)objc_msgSend(controller, selector, self, animated);
ok = ok & (BOOL)(int)objc_msgSend(controller, selector, self, animated);
// if that fails, check if it's a navigation controller and use the top controller
else if ([controller isKindOfClass:[UINavigationController class]]) {
UIViewController* topController = ((UINavigationController*)controller).topViewController;
if ([topController respondsToSelector:selector])
ok = ok & (BOOL)objc_msgSend(topController, selector, self, animated);
ok = ok & (BOOL)(int)objc_msgSend(topController, selector, self, animated);
}
}

Expand Down
6 changes: 6 additions & 0 deletions ViewDeck/WrappedController.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
// SOFTWARE.
//

#if __has_feature(objc_arc) && __clang_major__ >= 3
#define II_ARC_ENABLED 1
#endif // __has_feature(objc_arc)

#import "WrappedController.h"

Expand Down Expand Up @@ -63,6 +66,9 @@ - (void)viewDidUnload

- (void)dealloc {
_wrappedController = nil;
#if !II_ARC_ENABLED
[super dealloc];
#endif
}

- (void)viewWillAppear:(BOOL)animated
Expand Down

0 comments on commit fa0580e

Please sign in to comment.