Permalink
Browse files

Add SYPageView

This will be necessary for page reuse once that is implemented.
  • Loading branch information...
1 parent 731489c commit 86890e5db1816e1b2422c486898996d861c3622e @soffes soffes committed Mar 9, 2012
View
@@ -0,0 +1,8 @@
+.DS_Store
+*xcuserdata/
+*build/
+*.mode1v3
+*.pbxuser
+*.xcworkspace
+*.moved-aside/
+*.zip
@@ -0,0 +1,13 @@
+//
+// PEPageView.h
+// Paginator Example
+//
+// Created by Sam Soffes on 3/8/12.
+// Copyright (c) 2012 Synthetic. All rights reserved.
+//
+
+@interface PEPageView : SYPageView
+
+@property (nonatomic, strong, readonly) UILabel *textLabel;
+
+@end
@@ -0,0 +1,29 @@
+//
+// PEPageView.m
+// Paginator Example
+//
+// Created by Sam Soffes on 3/8/12.
+// Copyright (c) 2012 Synthetic. All rights reserved.
+//
+
+#import "PEPageView.h"
+
+@implementation PEPageView
+
+@synthesize textLabel = _textLabel;
+
+- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier {
+ if ((self = [super initWithReuseIdentifier:reuseIdentifier])) {
+ self.backgroundColor = [UIColor colorWithWhite:0.2f alpha:1.0f];
+
+ _textLabel = [[UILabel alloc] initWithFrame:self.bounds];
+ _textLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ _textLabel.backgroundColor = [UIColor clearColor];
+ _textLabel.textAlignment = UITextAlignmentCenter;
+ _textLabel.textColor = [UIColor whiteColor];
+ [self addSubview:_textLabel];
+ }
+ return self;
+}
+
+@end
@@ -7,12 +7,38 @@
//
#import "PERootViewController.h"
+#import "PEPageView.h"
@implementation PERootViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Paginator";
+ self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
+
+ self.view.backgroundColor = [UIColor blackColor];
+ self.paginatorView.pageGap = 30.0f;
+}
+
+
+#pragma mark - SYPaginatorViewDataSource
+
+- (NSUInteger)numberOfPagesForPaginatorView:(SYPaginatorView *)paginator {
+ return 10;
+}
+
+
+- (UIView *)paginatorView:(SYPaginatorView *)paginator viewForPage:(NSUInteger)page {
+ static NSString *identifier = @"identifier";
+
+ PEPageView *view = [paginator dequeueReusableViewWithIdentifier:identifier];
+ if (!view) {
+ view = [[PEPageView alloc] initWithReuseIdentifier:identifier];
+ }
+
+ view.textLabel.text = [NSString stringWithFormat:@"Page %i", page + 1];
+
+ return view;
}
@end
@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
B275DFCE1509657000D6E7C1 /* PERootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B275DFCD1509656F00D6E7C1 /* PERootViewController.m */; };
+ B275DFF715097FD000D6E7C1 /* PEPageView.m in Sources */ = {isa = PBXBuildFile; fileRef = B275DFF615097FD000D6E7C1 /* PEPageView.m */; };
B2C4DF731509622800ABF21F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2C4DF721509622800ABF21F /* UIKit.framework */; };
B2C4DF751509622800ABF21F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2C4DF741509622800ABF21F /* Foundation.framework */; };
B2C4DF771509622800ABF21F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2C4DF761509622800ABF21F /* CoreGraphics.framework */; };
@@ -36,6 +37,8 @@
/* Begin PBXFileReference section */
B275DFCC1509656F00D6E7C1 /* PERootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PERootViewController.h; sourceTree = "<group>"; };
B275DFCD1509656F00D6E7C1 /* PERootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PERootViewController.m; sourceTree = "<group>"; };
+ B275DFF515097FD000D6E7C1 /* PEPageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PEPageView.h; sourceTree = "<group>"; };
+ B275DFF615097FD000D6E7C1 /* PEPageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PEPageView.m; sourceTree = "<group>"; };
B2C4DF6E1509622800ABF21F /* Paginator Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Paginator Example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
B2C4DF721509622800ABF21F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
B2C4DF741509622800ABF21F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -100,6 +103,8 @@
B2C4DF90150962AD00ABF21F /* PEAppDelegate.m */,
B275DFCC1509656F00D6E7C1 /* PERootViewController.h */,
B275DFCD1509656F00D6E7C1 /* PERootViewController.m */,
+ B275DFF515097FD000D6E7C1 /* PEPageView.h */,
+ B275DFF615097FD000D6E7C1 /* PEPageView.m */,
);
path = Classes;
sourceTree = "<group>";
@@ -211,6 +216,7 @@
B2C4DF96150962AD00ABF21F /* PEAppDelegate.m in Sources */,
B2C4DF97150962AD00ABF21F /* main.m in Sources */,
B275DFCE1509657000D6E7C1 /* PERootViewController.m in Sources */,
+ B275DFF715097FD000D6E7C1 /* PEPageView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -24,6 +24,8 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
+ <key>UIStatusBarStyle</key>
+ <string>UIStatusBarStyleBlackOpaque</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
@@ -7,6 +7,10 @@
objects = {
/* Begin PBXBuildFile section */
+ B275DFEF1509783500D6E7C1 /* SYPageView.h in Headers */ = {isa = PBXBuildFile; fileRef = B275DFED1509783500D6E7C1 /* SYPageView.h */; };
+ B275DFF01509783500D6E7C1 /* SYPageView.m in Sources */ = {isa = PBXBuildFile; fileRef = B275DFEE1509783500D6E7C1 /* SYPageView.m */; };
+ B275DFF31509788C00D6E7C1 /* SYPaginatorScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = B275DFF11509788C00D6E7C1 /* SYPaginatorScrollView.h */; };
+ B275DFF41509788C00D6E7C1 /* SYPaginatorScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = B275DFF21509788C00D6E7C1 /* SYPaginatorScrollView.m */; };
B2C4DF571509621B00ABF21F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2C4DF561509621B00ABF21F /* Foundation.framework */; };
B2C4DFAE1509631500ABF21F /* SYPaginatorView.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C4DFA91509631500ABF21F /* SYPaginatorView.h */; };
B2C4DFAF1509631500ABF21F /* SYPaginatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C4DFAA1509631500ABF21F /* SYPaginatorView.m */; };
@@ -16,6 +20,10 @@
/* Begin PBXFileReference section */
B275DFCB150964F100D6E7C1 /* SYPaginator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SYPaginator.h; sourceTree = "<group>"; };
+ B275DFED1509783500D6E7C1 /* SYPageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SYPageView.h; sourceTree = "<group>"; };
+ B275DFEE1509783500D6E7C1 /* SYPageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SYPageView.m; sourceTree = "<group>"; };
+ B275DFF11509788C00D6E7C1 /* SYPaginatorScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SYPaginatorScrollView.h; sourceTree = "<group>"; };
+ B275DFF21509788C00D6E7C1 /* SYPaginatorScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SYPaginatorScrollView.m; sourceTree = "<group>"; };
B2C4DF531509621B00ABF21F /* libSYPaginator.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSYPaginator.a; sourceTree = BUILT_PRODUCTS_DIR; };
B2C4DF561509621B00ABF21F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
B2C4DFA91509631500ABF21F /* SYPaginatorView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SYPaginatorView.h; sourceTree = "<group>"; };
@@ -69,6 +77,10 @@
B2C4DFAA1509631500ABF21F /* SYPaginatorView.m */,
B2C4DFAB1509631500ABF21F /* SYPaginatorViewController.h */,
B2C4DFAC1509631500ABF21F /* SYPaginatorViewController.m */,
+ B275DFED1509783500D6E7C1 /* SYPageView.h */,
+ B275DFEE1509783500D6E7C1 /* SYPageView.m */,
+ B275DFF11509788C00D6E7C1 /* SYPaginatorScrollView.h */,
+ B275DFF21509788C00D6E7C1 /* SYPaginatorScrollView.m */,
);
path = SYPaginator;
sourceTree = "<group>";
@@ -82,6 +94,8 @@
files = (
B2C4DFAE1509631500ABF21F /* SYPaginatorView.h in Headers */,
B2C4DFB01509631500ABF21F /* SYPaginatorViewController.h in Headers */,
+ B275DFEF1509783500D6E7C1 /* SYPageView.h in Headers */,
+ B275DFF31509788C00D6E7C1 /* SYPaginatorScrollView.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -138,6 +152,8 @@
files = (
B2C4DFAF1509631500ABF21F /* SYPaginatorView.m in Sources */,
B2C4DFB11509631500ABF21F /* SYPaginatorViewController.m in Sources */,
+ B275DFF01509783500D6E7C1 /* SYPageView.m in Sources */,
+ B275DFF41509788C00D6E7C1 /* SYPaginatorScrollView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Oops, something went wrong.
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Scheme
- version = "1.3">
- <BuildAction
- parallelizeBuildables = "YES"
- buildImplicitDependencies = "YES">
- <BuildActionEntries>
- <BuildActionEntry
- buildForTesting = "YES"
- buildForRunning = "YES"
- buildForProfiling = "YES"
- buildForArchiving = "YES"
- buildForAnalyzing = "YES">
- <BuildableReference
- BuildableIdentifier = "primary"
- BlueprintIdentifier = "B2C4DF521509621B00ABF21F"
- BuildableName = "libSYPaginator.a"
- BlueprintName = "SYPaginator"
- ReferencedContainer = "container:SYPaginator.xcodeproj">
- </BuildableReference>
- </BuildActionEntry>
- </BuildActionEntries>
- </BuildAction>
- <TestAction
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- shouldUseLaunchSchemeArgsEnv = "YES"
- buildConfiguration = "Debug">
- <Testables>
- </Testables>
- </TestAction>
- <LaunchAction
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- launchStyle = "0"
- useCustomWorkingDirectory = "NO"
- buildConfiguration = "Debug"
- ignoresPersistentStateOnLaunch = "NO"
- debugDocumentVersioning = "YES"
- allowLocationSimulation = "YES">
- <AdditionalOptions>
- </AdditionalOptions>
- </LaunchAction>
- <ProfileAction
- shouldUseLaunchSchemeArgsEnv = "YES"
- savedToolIdentifier = ""
- useCustomWorkingDirectory = "NO"
- buildConfiguration = "Release"
- debugDocumentVersioning = "YES">
- </ProfileAction>
- <AnalyzeAction
- buildConfiguration = "Debug">
- </AnalyzeAction>
- <ArchiveAction
- buildConfiguration = "Release"
- revealArchiveInOrganizer = "YES">
- </ArchiveAction>
-</Scheme>
@@ -1,22 +0,0 @@
-<?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>SYPaginator.xcscheme</key>
- <dict>
- <key>orderHint</key>
- <integer>0</integer>
- </dict>
- </dict>
- <key>SuppressBuildableAutocreation</key>
- <dict>
- <key>B2C4DF521509621B00ABF21F</key>
- <dict>
- <key>primary</key>
- <true/>
- </dict>
- </dict>
-</dict>
-</plist>
@@ -0,0 +1,18 @@
+//
+// SYPageView.h
+// SYPaginator
+//
+// Created by Sam Soffes on 3/8/12.
+// Copyright (c) 2012 Synthetic. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface SYPageView : UIView
+
+@property (nonatomic, strong, readonly) NSString *reuseIdentifier;
+
+- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier;
+- (void)prepareForReuse;
+
+@end
@@ -0,0 +1,32 @@
+//
+// SYPageView.m
+// SYPaginator
+//
+// Created by Sam Soffes on 3/8/12.
+// Copyright (c) 2012 Synthetic. All rights reserved.
+//
+
+#import "SYPageView.h"
+
+@interface SYPageView ()
+@property (nonatomic, strong, readwrite) NSString *reuseIdentifier;
+@end
+
+@implementation SYPageView
+
+@synthesize reuseIdentifier = _reuseIdentifier;
+
+- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier {
+ if ((self = [super initWithFrame:CGRectZero])) {
+ self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ self.reuseIdentifier = reuseIdentifier;
+ }
+ return self;
+}
+
+
+- (void)prepareForReuse {
+ // Subclasses may override this
+}
+
+@end
@@ -8,3 +8,4 @@
#import <SYPaginator/SYPaginatorView.h>
#import <SYPaginator/SYPaginatorViewController.h>
+#import <SYPaginator/SYPageView.h>
@@ -0,0 +1,15 @@
+//
+// SYPaginatorScrollView.h
+// SYPaginator
+//
+// Created by Sam Soffes on 3/8/12.
+// Copyright (c) 2012 Synthetic. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface SYPaginatorScrollView : UIScrollView
+
+@property (nonatomic, unsafe_unretained) id<UIScrollViewDelegate> privateDelegate;
+
+@end
@@ -0,0 +1,27 @@
+//
+// SYPaginatorScrollView.m
+// SYPaginator
+//
+// Created by Sam Soffes on 3/8/12.
+// Copyright (c) 2012 Synthetic. All rights reserved.
+//
+
+#import "SYPaginatorScrollView.h"
+
+@implementation SYPaginatorScrollView
+
+- (void)setDelegate:(id<UIScrollViewDelegate>)delegate {
+ return;
+}
+
+
+- (id<UIScrollViewDelegate>)privateDelegate {
+ return [self delegate];
+}
+
+
+- (void)setPrivateDelegate:(id<UIScrollViewDelegate>)privateDelegate {
+ [super setDelegate:privateDelegate];
+}
+
+@end
Oops, something went wrong.

0 comments on commit 86890e5

Please sign in to comment.