Skip to content
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 PanelTableView/.DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions PanelTableView/Classes/PanelView.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
- (CGFloat)panelView:(id)panelView heightForRowAtIndexPath:(PanelIndexPath *)indexPath;
- (NSInteger)panelView:(id)panelView numberOfSectionsInPage:(NSInteger)pageNumber;
- (NSString*)panelView:(id)panelView titleForHeaderInPage:(NSInteger)pageNumber section:(NSInteger)section;
- (UIView *)panelView:(id)panelView viewForHeaderInPage:(NSInteger)pageNumber section:(NSInteger)section;
- (void)panelView:(id)panelView didScroll:(UIScrollView *)scrollView;
- (CGFloat)panelView:(id)panelView heightForHeaderInSection:(NSInteger)section;
@end

@interface PanelView : UIView <UITableViewDelegate, UITableViewDataSource>
Expand Down
24 changes: 24 additions & 0 deletions PanelTableView/Classes/PanelView.m
Original file line number Diff line number Diff line change
Expand Up @@ -391,4 +391,28 @@ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInte
return nil;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
if ([self.delegate respondsToSelector:@selector(panelView:viewForHeaderInPage:section:)]) {
return [self.delegate panelView:self viewForHeaderInPage:self.pageNumber section:section];
}
return nil;
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if ([self.delegate respondsToSelector:@selector(panelView:didScroll:)]) {
return [self.delegate panelView:self didScroll:scrollView];
}
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if ([self.delegate respondsToSelector:@selector(panelView:heightForHeaderInSection:)]) {
return [self.delegate panelView:self heightForHeaderInSection:section];
} else {
return 0;
}
}

@end
4 changes: 3 additions & 1 deletion PanelTableView/Classes/PanelsViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@
- (void)pushNextPage;
- (void)jumpToPreviousPage;


- (NSInteger)numberOfPanels;

#pragma mark - PYology, Yann
- (void)goToPanel:(NSInteger)index;

@end
8 changes: 7 additions & 1 deletion PanelTableView/Classes/PanelsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ - (void)loadView
[_scrollView setPagingEnabled:YES];
[_scrollView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];
[self.view addSubview:self.scrollView];
[_scrollView setContentSize:CGSizeMake(([self panelViewSize].width+2*GAP)*[self numberOfPanels],_scrollView.frame.size.height)];
[_scrollView setContentSize:CGSizeMake(([self panelViewSize].width+2*GAP)*[self numberOfPanels],_scrollView.frame.size.height-frame.origin.y)];

_recycledPages = [NSMutableSet set];
_visiblePages = [NSMutableSet set];
Expand Down Expand Up @@ -408,5 +408,11 @@ - (NSString*)panelView:(id)panelView titleForHeaderInPage:(NSInteger)pageNumber
return [NSString stringWithFormat:@"Page %i Section %i", pageNumber, section];
}

- (void)goToPanel:(NSInteger)index
{
self.scrollView.bounds = CGRectMake(index * self.scrollView.bounds.size.width, self.scrollView.bounds.origin.y, self.scrollView.bounds.size.width, self.scrollView.bounds.size.height);

[self tilePages];
}

@end

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 = "1D6058900D05DD3D006BFB54"
BuildableName = "PanelTableView.app"
BlueprintName = "PanelTableView"
ReferencedContainer = "container:PanelTableView.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 = "1D6058900D05DD3D006BFB54"
BuildableName = "PanelTableView.app"
BlueprintName = "PanelTableView"
ReferencedContainer = "container:PanelTableView.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 = "1D6058900D05DD3D006BFB54"
BuildableName = "PanelTableView.app"
BlueprintName = "PanelTableView"
ReferencedContainer = "container:PanelTableView.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "PanelTableView.app"
BlueprintName = "PanelTableView"
ReferencedContainer = "container:PanelTableView.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>PanelTableView.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>1D6058900D05DD3D006BFB54</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ Contact
[honcheng.com](http://honcheng.com)
[@honcheng](http://twitter.com/honcheng)

![](http://www.cocoacontrols.com/analytics/honcheng/paneltableview.png)

Binary file added sample project/SampleApp/.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 = "1D6058900D05DD3D006BFB54"
BuildableName = "SampleApp.app"
BlueprintName = "SampleApp"
ReferencedContainer = "container:SampleApp.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 = "1D6058900D05DD3D006BFB54"
BuildableName = "SampleApp.app"
BlueprintName = "SampleApp"
ReferencedContainer = "container:SampleApp.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 = "1D6058900D05DD3D006BFB54"
BuildableName = "SampleApp.app"
BlueprintName = "SampleApp"
ReferencedContainer = "container:SampleApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "SampleApp.app"
BlueprintName = "SampleApp"
ReferencedContainer = "container:SampleApp.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>SampleApp.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>1D6058900D05DD3D006BFB54</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>