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

Delegate methods #183

Open
wants to merge 2 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions JASidePanels.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
0656B8CB19312E02009F85B0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0656B8CA19312E02009F85B0 /* Images.xcassets */; };
5C49572716C555F700250332 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 5C49572616C555F700250332 /* Default-568h@2x.png */; };
95322A731517AEF40069C8D7 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95322A701517AEEB0069C8D7 /* QuartzCore.framework */; };
9561ACB2151286EE005889C6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9561ACB1151286EE005889C6 /* UIKit.framework */; };
Expand All @@ -24,6 +25,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
0656B8CA19312E02009F85B0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
06DA19A919311ECC00A1B489 /* JASidePanelControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JASidePanelControllerDelegate.h; path = Source/JASidePanelControllerDelegate.h; sourceTree = "<group>"; };
5C49572616C555F700250332 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
95322A701517AEEB0069C8D7 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
9561ACAD151286EE005889C6 /* JASidePanels.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JASidePanels.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -106,6 +109,7 @@
9561ACB8151286EE005889C6 /* Supporting Files */ = {
isa = PBXGroup;
children = (
0656B8CA19312E02009F85B0 /* Images.xcassets */,
9561AD1D15130F2A005889C6 /* JASidePanels-Info.plist */,
9561AD1E15130F2A005889C6 /* JASidePanels-Prefix.pch */,
9561AD1F15130F2A005889C6 /* main.m */,
Expand All @@ -121,6 +125,7 @@
9561AD0E15130EE2005889C6 /* JASidePanelController.m */,
95BCC45815F081130009F1DA /* UIViewController+JASidePanel.h */,
95BCC45915F081130009F1DA /* UIViewController+JASidePanel.m */,
06DA19A919311ECC00A1B489 /* JASidePanelControllerDelegate.h */,
);
name = Source;
sourceTree = "<group>";
Expand Down Expand Up @@ -194,6 +199,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0656B8CB19312E02009F85B0 /* Images.xcassets in Resources */,
9561ACBC151286EE005889C6 /* InfoPlist.strings in Resources */,
5C49572716C555F700250332 /* Default-568h@2x.png in Resources */,
);
Expand Down Expand Up @@ -289,6 +295,8 @@
9561ACCF151286EE005889C6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "JASidePanels/Demo/JASidePanels-Prefix.pch";
INFOPLIST_FILE = "JASidePanels/Demo/JASidePanels-Info.plist";
Expand All @@ -301,6 +309,8 @@
9561ACD0151286EE005889C6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "JASidePanels/Demo/JASidePanels-Prefix.pch";
INFOPLIST_FILE = "JASidePanels/Demo/JASidePanels-Info.plist";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>ED7F3891-B509-4CC9-AE57-BB272830921B</string>
<key>IDESourceControlProjectName</key>
<string>JASidePanels</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>2ECBDB9E-3A0A-40C0-A316-99F0EF4055ED</key>
<string>https://github.com/eriadam/JASidePanels.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>JASidePanels.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>2ECBDB9E-3A0A-40C0-A316-99F0EF4055ED</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/eriadam/JASidePanels.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>2ECBDB9E-3A0A-40C0-A316-99F0EF4055ED</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>2ECBDB9E-3A0A-40C0-A316-99F0EF4055ED</string>
<key>IDESourceControlWCCName</key>
<string>JASidePanels</string>
</dict>
</array>
</dict>
</plist>
5 changes: 2 additions & 3 deletions JASidePanels/Demo/JAAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@


#import <UIKit/UIKit.h>
#import "JASidePanelControllerDelegate.h"

@class JASidePanelController;

@interface JAAppDelegate : UIResponder <UIApplicationDelegate>
@interface JAAppDelegate : UIResponder <UIApplicationDelegate, JASidePanelControllerDelegate>

@property (strong, nonatomic) UIWindow *window;

Expand Down
34 changes: 32 additions & 2 deletions JASidePanels/Demo/JAAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ @implementation JAAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

self.viewController = [[JASidePanelController alloc] init];

JASidePanelController *sidePanelController = [[JASidePanelController alloc] init];
sidePanelController.delegate = self;
self.viewController = sidePanelController;

self.viewController.shouldDelegateAutorotateToVisiblePanel = NO;

self.viewController.leftPanel = [[JALeftViewController alloc] init];
Expand All @@ -51,5 +54,32 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
return YES;
}

#pragma mark - JASidePanelControllerDelegate

#pragma mark Customisation

- (CGFloat)borderRadiusForPanel:(UIView *)panel {
return 0.0f;
}

- (UIImage *)imageForLeftButtonForCenterPanel {
return [UIImage imageNamed:@"menu-icon"];
}

#pragma mark Event Notifications

- (void)panelController:(JASidePanelController *)panelController willShowLeftPanelAnimated:(BOOL)animated {
NSLog(@"willShowLeftPanelAnimated");
}

- (void)panelController:(JASidePanelController *)panelController willShowRightPanelAnimated:(BOOL)animated {
NSLog(@"willShowRightPanelAnimated");
}

- (void)panelController:(JASidePanelController *)panelController willShowCenterPanelAnimated:(BOOL)animated {
NSLog(@"willShowCenterPanelAnimated");
}



@end
4 changes: 4 additions & 0 deletions JASidePanels/Demo/JASidePanels-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIcons</key>
<dict/>
<key>CFBundleIcons~ipad</key>
<dict/>
<key>CFBundleIdentifier</key>
<string>com.nimjun.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand Down
88 changes: 88 additions & 0 deletions JASidePanels/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "1x",
"size" : "57x57"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "57x57"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "72x72"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "72x72"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "iphone",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "50x50"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "50x50"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
91 changes: 91 additions & 0 deletions JASidePanels/Images.xcassets/LaunchImage.launchimage/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "1x",
"orientation" : "portrait"
},
{
"idiom" : "iphone",
"scale" : "2x",
"orientation" : "portrait"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "Default-568h@2x.png",
"subtype" : "retina4",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "Default-568h@2x.png",
"minimum-system-version" : "7.0",
"subtype" : "retina4",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions JASidePanels/Images.xcassets/menu-icon.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "menu-icon.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "menu-icon@2x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions JASidePanels/Source/JASidePanelController.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/

#import <UIKit/UIKit.h>
#import "JASidePanelControllerDelegate.h"

typedef enum _JASidePanelStyle {
JASidePanelSingleActive = 0,
Expand All @@ -38,6 +39,8 @@ typedef enum _JASidePanelState {

@interface JASidePanelController : UIViewController<UIGestureRecognizerDelegate>

@property (nonatomic, strong) id<JASidePanelControllerDelegate> delegate;

#pragma mark - Usage

// set the panels
Expand Down