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

Changed selectedIndex to selectedIndexPath, make menuViewController support multiple section #12

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
Binary file added Demo/.DS_Store
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0450"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8938452163AD2BE0085C3BB"
BuildableName = "Demo.app"
BlueprintName = "Demo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8938452163AD2BE0085C3BB"
BuildableName = "Demo.app"
BlueprintName = "Demo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8938452163AD2BE0085C3BB"
BuildableName = "Demo.app"
BlueprintName = "Demo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8938452163AD2BE0085C3BB"
BuildableName = "Demo.app"
BlueprintName = "Demo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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>SchemeUserState</key>
<dict>
<key>Demo.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>F8938452163AD2BE0085C3BB</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
28 changes: 25 additions & 3 deletions Demo/Demo/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,36 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

NSMutableArray *viewControllers = [NSMutableArray array];

for (int i=0; i<8; i++)
NSMutableArray *viewControllerA = [NSMutableArray array];
NSMutableArray *viewControllerB = [NSMutableArray array];
NSMutableArray *viewControllerC = [NSMutableArray array];

for (int i=0; i<3; i++)
{
DemoRootViewController *rootViewController = [[DemoRootViewController alloc] init];
[rootViewController setTitle:[NSString stringWithFormat:@"Root VC A %i", i+1]];
UINavigationController *rootNavController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
[viewControllerA addObject:rootNavController];
}
[viewControllers addObject:viewControllerA];

for (int i=0; i<2; i++)
{
DemoRootViewController *rootViewController = [[DemoRootViewController alloc] init];
[rootViewController setTitle:[NSString stringWithFormat:@"Root VC %i", i+1]];
[rootViewController setTitle:[NSString stringWithFormat:@"Root VC B %i", i+1]];
UINavigationController *rootNavController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
[viewControllers addObject:rootNavController];
[viewControllerB addObject:rootNavController];
}
[viewControllers addObject:viewControllerB];

for (int i=0; i<3; i++)
{
DemoRootViewController *rootViewController = [[DemoRootViewController alloc] init];
[rootViewController setTitle:[NSString stringWithFormat:@"Root VC C %i", i+1]];
UINavigationController *rootNavController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
[viewControllerC addObject:rootNavController];
}
[viewControllers addObject:viewControllerC];

[_menuController setViewControllers:viewControllers];

Expand Down
4 changes: 2 additions & 2 deletions Demo/Demo/DemoMenuController.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS

}

UIViewController *viewController = self.viewControllers[indexPath.row];
UIViewController *viewController = self.viewControllers[indexPath.section][indexPath.row];
[cell.textLabel setText:viewController.title];

if (indexPath.row==self.selectedIndex)
if (indexPath.section==self.selectedIndexPath.section && indexPath.row==self.selectedIndexPath.row)
{
[tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
}
Expand Down
35 changes: 35 additions & 0 deletions PaperFoldMenuController.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#
# Be sure to run `pod lib lint PaperFoldMenuController.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# Any lines starting with a # are optional, but encouraged
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
s.name = "PaperFoldMenuController"
s.version = "1.0.1-1.0.1"
s.summary = "Left side menu with paper fold effect"
s.description = <<-DESC
PaperFoldMenuController is a UITabBarController replacement, but displays the view controllers in a table view on the left side of the screen. This table view is shown/hidden using PaperFold-for-iOS. Selecting from the menu on the left changes the view controller on the right. PaperFoldMenuController uses view controller containment.
DESC
s.homepage = "https://github.com/cielliang/PaperFoldMenuController"
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT'
s.author = { "hongcheng" => "hongcheng@gmail.com", "Weiyin LIANG" => "weiyin.liang@gmail.com" }
s.source = { :git => "https://github.com/cielliang/PaperFoldMenuController.git", :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

s.platform = :ios, '7.0'
s.requires_arc = true

s.source_files = 'PaperFoldMenuController'
#s.resource_bundles = {
# 'PanelTableView2' => ['Pod/Assets/*.png']
#}

# s.public_header_files = 'Pod/Classes/**/*.h'
s.frameworks = 'UIKit'
s.dependency 'PaperFold', '~> 1.1'
end
10 changes: 9 additions & 1 deletion PaperFoldMenuController/PaperFoldMenuController.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
/**
* Set and return the index of the current view controller
*/
@property (nonatomic, assign) NSUInteger selectedIndex;
//@property (nonatomic, assign) NSUInteger selectedIndex;
@property (nonatomic, strong) NSIndexPath *selectedIndexPath;
@property (nonatomic, assign, readonly) float menuWidth;
@property (nonatomic, assign, readonly) int numberOfFolds;
/**
Expand All @@ -65,4 +66,11 @@
* @param animated A boolean value to indicate if the folding/unfolding should be animated
*/
- (void)showMenu:(BOOL)show animated:(BOOL)animated;

- (void)insertViewController:(UIViewController *)viewController atSectionIndex:(NSInteger)sectionIndex rowIndex:(NSInteger)rowIndex;

- (void)addViewController:(UIViewController *)viewController atSectionIndex:(NSInteger)sectionIndex;

- (void)removeViewControllerAtSectionIndex:(NSInteger)sectionIndex rowIndex:(NSInteger)rowIndex;

@end
Loading