Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved iOS 7 status bar view #210

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>88813EDE-C4BC-4EAD-BA3F-F5FC71109468</string>
<string>D3FB706E-2D9D-49C9-A41B-C96BA055436E</string>
<key>IDESourceControlProjectName</key>
<string>MMDrawerControllerKitchenSink</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>C486FB0C-7803-4607-BCA9-799E743ECFBA</key>
<string>https://github.com/mutualmobile/MMDrawerController.git</string>
<key>3BEF8252-7798-436C-8CB9-B085CDB20C27</key>
<string>https://github.com/JonasGessner/MMDrawerController.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>C486FB0C-7803-4607-BCA9-799E743ECFBA</key>
<key>3BEF8252-7798-436C-8CB9-B085CDB20C27</key>
<string>../../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/mutualmobile/MMDrawerController.git</string>
<string>https://github.com/JonasGessner/MMDrawerController.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>C486FB0C-7803-4607-BCA9-799E743ECFBA</string>
<string>3BEF8252-7798-436C-8CB9-B085CDB20C27</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>C486FB0C-7803-4607-BCA9-799E743ECFBA</string>
<string>3BEF8252-7798-436C-8CB9-B085CDB20C27</string>
<key>IDESourceControlWCCName</key>
<string>MMDrawerController-GitHub</string>
<string>MMDrawerController</string>
</dict>
</array>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion MMDrawerController/MMDrawerBarButtonItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

@return The newly-initialized bar button item.
*/
-(id)initWithTarget:(id)target action:(SEL)action;
-(instancetype)initWithTarget:(id)target action:(SEL)action;

/**
Returns the current color of the menu button for the state requested. This property is deprecated in iOS 7.0. Use `tintColor` instead.
Expand Down
6 changes: 3 additions & 3 deletions MMDrawerController/MMDrawerBarButtonItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ -(void)setShadowColor:(UIColor *)color forState:(UIControlState)state;

@implementation MMDrawerMenuButtonView

-(id)initWithFrame:(CGRect)frame{
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self setMenuButtonNormalColor:[[UIColor whiteColor] colorWithAlphaComponent:0.9f]];
Expand Down Expand Up @@ -238,7 +238,7 @@ +(UIImage*)drawerButtonItemImage{
return drawerButtonImage;
}

-(id)initWithTarget:(id)target action:(SEL)action{
-(instancetype)initWithTarget:(id)target action:(SEL)action{

if((floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1)){
return [self initWithImage:[self.class drawerButtonItemImage]
Expand All @@ -259,7 +259,7 @@ -(id)initWithTarget:(id)target action:(SEL)action{
}
}

-(id)initWithCoder:(NSCoder *)aDecoder{
-(instancetype)initWithCoder:(NSCoder *)aDecoder{
// non-ideal way to get the target/action, but it works
UIBarButtonItem* barButtonItem = [[UIBarButtonItem alloc] initWithCoder: aDecoder];
return [self initWithTarget:barButtonItem.target action:barButtonItem.action];
Expand Down
59 changes: 56 additions & 3 deletions MMDrawerController/MMDrawerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,26 @@
- Support container view controllers other than `UINavigationController` as the center view controller.
*/


typedef struct {
CGFloat shadowRadius;
CGFloat shadowOpacity;

CGSize shadowOffset;
} MMShadowOptions;


NS_INLINE MMShadowOptions MMShadowOptionsMake(CGFloat shadowRadius, CGFloat shadowOpacity, CGSize shadowOffset) {
MMShadowOptions options;

options.shadowRadius = shadowRadius;
options.shadowOpacity = shadowOpacity;
options.shadowOffset = shadowOffset;

return options;
}


typedef NS_ENUM(NSInteger,MMDrawerSide){
MMDrawerSideNone = 0,
MMDrawerSideLeft,
Expand Down Expand Up @@ -165,6 +185,12 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController * dr
*/
@property (nonatomic, assign) BOOL shouldStretchDrawer;


/**
A boolean that determines whether or not the side drawers should be stretched with the center drawer. This only has any effects when \c shouldStretchDrawer is set to \c YES.
*/
@property (nonatomic, assign) BOOL shouldStrechSideDrawers;

/**
The current open side of the drawer.

Expand Down Expand Up @@ -193,13 +219,28 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController * dr
*/
@property (nonatomic, assign) MMDrawerOpenCenterInteractionMode centerHiddenInteractionMode;

/**
A structure containing information about the shadow.

By default, this is set to {0.8f, 10.0f, {0.0f, 0.0f}}
*/
@property (nonatomic, assign) MMShadowOptions shadowOptions;

/**
The flag determining if a shadow should be drawn off of `centerViewController` when a drawer is open.

By default, this is set to YES.
*/
@property (nonatomic, assign) BOOL showsShadow;

/**
The value by how many points the center view's top corners should be rounded.

By default, this is set to 0.0f;
*/
@property (nonatomic, assign) CGFloat centerViewTopCornerRadius;


/**
The flag determining if a custom background view should appear beneath the status bar, forcing the child content to be drawn lower than the status bar. This property is only available for > iOS 7.0 to take into account for the new behavior of the status bar.

Expand All @@ -214,6 +255,13 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController * dr
*/
@property (nonatomic, strong) UIColor * statusBarViewBackgroundColor;


/**
Returns if the drawer is currently moving.
*/
- (BOOL)isAnimatingDrawer;


///---------------------------------------
/// @name Initializing a `MMDrawerController`
///---------------------------------------
Expand All @@ -227,7 +275,7 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController * dr

@return The newly-initialized drawer container view controller.
*/
-(id)initWithCenterViewController:(UIViewController *)centerViewController leftDrawerViewController:(UIViewController *)leftDrawerViewController rightDrawerViewController:(UIViewController *)rightDrawerViewController;
-(instancetype)initWithCenterViewController:(UIViewController *)centerViewController leftDrawerViewController:(UIViewController *)leftDrawerViewController rightDrawerViewController:(UIViewController *)rightDrawerViewController;

/**
Creates and initializes an `MMDrawerController` object with the specified center view controller, left drawer view controller.
Expand All @@ -237,7 +285,7 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController * dr

@return The newly-initialized drawer container view controller.
*/
-(id)initWithCenterViewController:(UIViewController *)centerViewController leftDrawerViewController:(UIViewController *)leftDrawerViewController;
-(instancetype)initWithCenterViewController:(UIViewController *)centerViewController leftDrawerViewController:(UIViewController *)leftDrawerViewController;

/**
Creates and initializes an `MMDrawerController` object with the specified center view controller, right drawer view controller.
Expand All @@ -247,7 +295,7 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController * dr

@return The newly-initialized drawer container view controller.
*/
-(id)initWithCenterViewController:(UIViewController *)centerViewController rightDrawerViewController:(UIViewController *)rightDrawerViewController;
-(instancetype)initWithCenterViewController:(UIViewController *)centerViewController rightDrawerViewController:(UIViewController *)rightDrawerViewController;

///---------------------------------------
/// @name Opening and Closing a Drawer
Expand All @@ -274,6 +322,11 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController * dr
*/
-(void)closeDrawerAnimated:(BOOL)animated completion:(void(^)(BOOL finished))completion;

/**
Closes the open drawer by performing a full animation.
*/
- (void)closeDrawerWithFullAnimation:(void (^)(void))completion;

/**
Opens the `drawer` passed in.

Expand Down
Loading