Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Tidying up for publication - renamed example project, improved commen…

…ts and updated copyright headers
  • Loading branch information...
commit 6eba0c2bc7c4729b5f0a1a97798027cac9b81b15 1 parent 16ca185
Ben Stovold authored October 17, 2011
41  TPScrollBarController.h
... ...
@@ -0,0 +1,41 @@
  1
+//
  2
+//  TPScrollBarController.h
  3
+//  TPScrollBarController
  4
+//
  5
+//  Copyright 2011 Ben Stovold. All rights reserved.
  6
+//
  7
+
  8
+#import <UIKit/UIKit.h>
  9
+#import "TPScrollBarDelegate.h"
  10
+
  11
+// A root container view controller in the vein of UITabBarController.
  12
+// Has a scrolling menubar at the bottom and allows:
  13
+//      * multiple bar buttons per controller
  14
+//      * bar buttons to be enabled or disabled
  15
+@interface TPScrollBarController : UIViewController {
  16
+
  17
+@private
  18
+    NSObject<TPScrollBarDelegate> *delegate_;
  19
+    
  20
+    UIScrollView            *scrollBar_;
  21
+    UIView                  *contentView_;
  22
+    UIViewController        *selectedViewController_;
  23
+    NSArray                 *scrollBarPageArray_;
  24
+    NSOrderedSet            *scrollBarPageSet_;
  25
+    NSSet                   *viewControllers_;
  26
+    NSArray                 *barButtons_;
  27
+    NSUInteger              selectedScrollBarPage_;
  28
+    NSArray                 *registry_;
  29
+}
  30
+
  31
+@property(nonatomic, strong)    NSObject<TPScrollBarDelegate>   *delegate;
  32
+@property(nonatomic, readonly)  UIViewController                *selectedViewController;
  33
+@property(nonatomic, readonly)  NSUInteger                      selectedScrollBarPage;
  34
+
  35
+- (void)setViewControllers:(NSSet *)viewControllers
  36
+            WithBarButtons:(NSArray *)barButtons
  37
+          onScrollBarPages:(NSArray *)pageNumbers;
  38
+
  39
+- (void)selectScrollBarPage:(NSUInteger)pageNumber animated:(BOOL)animated;
  40
+
  41
+@end
290  TPScrollBarController.m
... ...
@@ -0,0 +1,290 @@
  1
+//
  2
+//  TPScrollBarController.m
  3
+//  TPScrollBarController
  4
+//
  5
+//  Copyright 2011 Ben Stovold. All rights reserved.
  6
+//
  7
+
  8
+#import "TPScrollBarController.h"
  9
+#import <objc/message.h>
  10
+
  11
+#pragma mark Constants and enums
  12
+CGFloat         const   kScrollBarHeight = 88.f;
  13
+
  14
+#pragma mark -
  15
+@interface TPScrollBarController ()
  16
+
  17
+@property(nonatomic)  UIViewController *selectedViewController;
  18
+@property(nonatomic)  NSUInteger       selectedScrollBarPage;
  19
+
  20
+@property(nonatomic, strong)  UIScrollView     *scrollBar;
  21
+@property(nonatomic, strong)  UIView           *contentView;
  22
+@property(nonatomic, strong)  NSOrderedSet     *scrollBarPageSet;
  23
+@property(nonatomic, strong)  NSSet            *viewControllers;
  24
+@property(nonatomic, strong)  NSArray          *barButtons;
  25
+@property(nonatomic, strong)  NSArray          *scrollBarPageArray;
  26
+@property(nonatomic, strong)  NSArray          *registry;
  27
+
  28
+- (void)performSelectorOnDelegate:(SEL)aSelector withObject:(id)param1 andObject:(id)param2;
  29
+- (void)initaliseContainerViews;
  30
+- (void)resizeScrollBarForNumberOfPages;
  31
+- (void)layoutBarButtons;
  32
+- (void)registerBarButtonTargetsAsChildViewControllers;
  33
+- (void)barButtonReceivedTouchDown:(UIButton *)sender;
  34
+- (void)barButtonReceivedTouchUpInside:(UIButton *)sender;
  35
+
  36
+@end
  37
+
  38
+
  39
+#pragma mark -
  40
+@implementation TPScrollBarController
  41
+
  42
+#pragma mark Object lifecycle
  43
+
  44
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  45
+{
  46
+    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  47
+    if (self) {
  48
+        registry_ = [NSArray array];
  49
+    }
  50
+    return self;
  51
+}
  52
+
  53
+- (void)didReceiveMemoryWarning
  54
+{
  55
+    [super didReceiveMemoryWarning];
  56
+}
  57
+
  58
+#pragma mark Accessors and mutators
  59
+
  60
+@synthesize delegate = delegate_;
  61
+@synthesize scrollBar = scrollBar_;
  62
+@synthesize contentView = contentView_;
  63
+@synthesize selectedViewController = selectedViewController_;
  64
+@synthesize scrollBarPageSet = scrollBarPageSet_;
  65
+@synthesize selectedScrollBarPage = selectedScrollBarPage_;
  66
+@synthesize viewControllers = viewControllers_;
  67
+@synthesize barButtons = barButtons_;
  68
+
  69
+@synthesize scrollBarPageArray = scrollBarPageArray_;
  70
+@synthesize registry = registry_;
  71
+
  72
+
  73
+#pragma mark - View lifecycle
  74
+
  75
+- (void)viewDidLoad
  76
+{
  77
+    [super viewDidLoad];
  78
+    
  79
+}
  80
+
  81
+- (void)viewWillAppear:(BOOL)animated
  82
+{
  83
+    [super viewWillAppear:animated];
  84
+
  85
+    [self initaliseContainerViews];
  86
+    [self resizeScrollBarForNumberOfPages];
  87
+    [self layoutBarButtons];
  88
+    [self registerBarButtonTargetsAsChildViewControllers];
  89
+    self.selectedScrollBarPage = 1;
  90
+    [self.contentView addSubview:self.selectedViewController.view];
  91
+}
  92
+
  93
+- (void)viewDidUnload
  94
+{
  95
+    self.scrollBar = nil;
  96
+    self.contentView = nil;
  97
+    [super viewDidUnload];
  98
+}
  99
+
  100
+
  101
+#pragma mark - UIInterfaceOrientation methods
  102
+
  103
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  104
+{
  105
+    return (interfaceOrientation == UIInterfaceOrientationPortrait);
  106
+}
  107
+
  108
+
  109
+#pragma mark - Public methods
  110
+
  111
+- (void)setViewControllers:(NSSet *)viewControllers
  112
+            WithBarButtons:(NSArray *)barButtons
  113
+          onScrollBarPages:(NSArray *)pageNumbers
  114
+{
  115
+    NSAssert([barButtons count] == [pageNumbers count], @"barButton and pageNumber arrays must contain the same number of objects");
  116
+    for (UIButton *barButton in barButtons) {
  117
+        NSAssert([[barButton allTargets] count] == 1, @"barButtons can only have one target");
  118
+        NSAssert([[[[barButton allTargets] allObjects] objectAtIndex:0] isKindOfClass:[UIViewController class]], @"barButton target must be a UIViewController");
  119
+    }
  120
+    for (NSNumber *pageNumber in pageNumbers) {
  121
+        NSAssert([pageNumber integerValue] > 0, @"pageNumbers must be greater than zero");
  122
+    }
  123
+    
  124
+    NSSortDescriptor *ascending = [NSSortDescriptor sortDescriptorWithKey:@"self" ascending:YES];
  125
+    NSMutableArray *numbers = [NSMutableArray arrayWithArray:pageNumbers];
  126
+    [numbers sortUsingDescriptors:[NSArray arrayWithObject:ascending]];
  127
+    self.scrollBarPageSet = [NSOrderedSet orderedSetWithArray:numbers];
  128
+    self.viewControllers = viewControllers;
  129
+    self.barButtons = barButtons;
  130
+    self.scrollBarPageArray = pageNumbers;
  131
+}
  132
+
  133
+- (void)selectScrollBarPage:(NSUInteger)pageNumber animated:(BOOL)animated
  134
+{
  135
+    NSUInteger pageWidth = [[UIScreen mainScreen] applicationFrame].size.width;
  136
+    CGRect frame = self.scrollBar.bounds;
  137
+    frame.origin.x = pageWidth * (pageNumber - 1);
  138
+    [self.scrollBar scrollRectToVisible:frame animated:animated];
  139
+    self.selectedScrollBarPage = pageNumber;
  140
+}
  141
+
  142
+
  143
+#pragma mark - Private methods
  144
+
  145
+- (void)performSelectorOnDelegate:(SEL)aSelector withObject:(id)param1 andObject:(id)param2;
  146
+{
  147
+    if ([delegate_ respondsToSelector:aSelector])
  148
+        objc_msgSend(delegate_, aSelector, param1, param2); // performSelector: generates compiler warnings under ARC
  149
+}
  150
+
  151
+// Initialises an empty scrollBar and contentView and adds them as subviews.
  152
+- (void)initaliseContainerViews
  153
+{
  154
+    CGFloat xpos = 0.f;
  155
+    CGFloat width = [[UIScreen mainScreen] applicationFrame].size.width;
  156
+    CGFloat ypos = [[UIScreen mainScreen] applicationFrame].size.height - kScrollBarHeight;
  157
+    self.scrollBar = [[UIScrollView alloc] initWithFrame:CGRectMake(xpos, ypos, width, kScrollBarHeight)];
  158
+    [self.scrollBar setBackgroundColor:[UIColor redColor]];
  159
+    self.scrollBar.clipsToBounds = YES;
  160
+    self.scrollBar.scrollEnabled = YES;
  161
+	self.scrollBar.pagingEnabled = YES;
  162
+    self.scrollBar.showsHorizontalScrollIndicator = YES;
  163
+    self.scrollBar.showsVerticalScrollIndicator = YES;
  164
+    [self.view addSubview:self.scrollBar];
  165
+
  166
+    
  167
+    ypos = [[UIScreen mainScreen] bounds].origin.y;
  168
+    CGFloat height = [[UIScreen mainScreen] applicationFrame].size.height - kScrollBarHeight;
  169
+    self.contentView = [[UIView alloc] initWithFrame:CGRectMake(xpos, ypos, width, height)];
  170
+    [self.contentView setBackgroundColor:[UIColor greenColor]];
  171
+    self.contentView.clipsToBounds = YES;
  172
+    [self.view addSubview:self.contentView];
  173
+}
  174
+
  175
+- (void)resizeScrollBarForNumberOfPages
  176
+{
  177
+    CGSize size = self.scrollBar.frame.size;
  178
+    size.width = [[UIScreen mainScreen] applicationFrame].size.width * ((NSNumber *)[self.scrollBarPageSet lastObject]).integerValue;
  179
+    self.scrollBar.contentSize = size;
  180
+}
  181
+
  182
+- (void)layoutBarButtons
  183
+{
  184
+    // For each page (in order)
  185
+    for (NSNumber *page in self.scrollBarPageSet) {
  186
+        
  187
+        NSUInteger pageWidth = [[UIScreen mainScreen] applicationFrame].size.width;
  188
+        
  189
+        // Get indicies of buttons for this page
  190
+        NSIndexSet *buttonIndexSet = [self.scrollBarPageArray indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) {
  191
+            return obj == page;
  192
+        }];
  193
+        
  194
+        // Calculate the total width of buttons on this page.
  195
+        __block NSUInteger widthOfButtonsOnThisPage = 0;
  196
+        [buttonIndexSet enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
  197
+            UIButton *barButton = [self.barButtons objectAtIndex:idx];
  198
+            widthOfButtonsOnThisPage = widthOfButtonsOnThisPage + barButton.frame.size.width;
  199
+        }];
  200
+        
  201
+        NSAssert(widthOfButtonsOnThisPage < pageWidth, @"Can't fit barButtons on page %f", page);
  202
+        
  203
+        NSUInteger numberOfButtonsOnThisPage = [buttonIndexSet count];
  204
+        
  205
+        __block NSUInteger offset;
  206
+        
  207
+        // Calculate how far to offset each button from the left of the last one.
  208
+        offset = (pageWidth - widthOfButtonsOnThisPage) / (numberOfButtonsOnThisPage + 1);
  209
+        
  210
+        // Set the x position for the first button.
  211
+        __block NSUInteger xpos = offset + (pageWidth * (page.integerValue - 1));
  212
+        
  213
+        // For each button on the page (in order)
  214
+        [buttonIndexSet enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
  215
+            
  216
+            UIButton *barButton = [self.barButtons objectAtIndex:idx];
  217
+            
  218
+            // place it on the scrollBar according to the page offset.
  219
+            CGRect newFrame = barButton.frame;
  220
+            newFrame.origin.x = xpos;
  221
+            newFrame.origin.y = barButton.frame.size.height / 2;
  222
+            barButton.frame = newFrame;
  223
+            [self.scrollBar addSubview:barButton];
  224
+            
  225
+            // Calculate the x origin for the next pass through
  226
+            xpos = xpos + barButton.frame.size.width + offset;
  227
+            
  228
+        }];
  229
+    }
  230
+}
  231
+
  232
+- (void)registerBarButtonTargetsAsChildViewControllers
  233
+{
  234
+    // For each bar button
  235
+    for (UIButton *barButton in self.barButtons) {
  236
+        
  237
+        if (self.viewControllers) {
  238
+            
  239
+            __block NSMutableSet *controllers = [NSMutableSet setWithArray:self.childViewControllers];
  240
+            [[barButton allTargets] enumerateObjectsUsingBlock:^(id target, BOOL *stop) {
  241
+
  242
+                // View Controller setter asserts that there is only one target.
  243
+                // That is, there should only be one target to 'enumerate'.
  244
+                UIViewController *controller = (UIViewController *)target;
  245
+                
  246
+                // If the target isn't already a child viewController, add it.
  247
+                if (![controllers containsObject:target]) {
  248
+                    [self addChildViewController:controller];
  249
+                    [controller didMoveToParentViewController:self];
  250
+                    if (!self.selectedViewController) self.selectedViewController = controller;
  251
+                    [controllers addObject:target];
  252
+                }
  253
+                
  254
+                // Register the button/ target/ action combination
  255
+                NSDictionary *entry = [NSDictionary dictionaryWithObjectsAndKeys:barButton, @"barButton", target, @"target", nil];
  256
+                self.registry = [self.registry arrayByAddingObject:entry];
  257
+
  258
+            }];
  259
+            
  260
+            // Add self as a target for touch events
  261
+            [barButton addTarget:self action:@selector(barButtonReceivedTouchDown:) forControlEvents:UIControlEventTouchDown];
  262
+            [barButton addTarget:self action:@selector(barButtonReceivedTouchUpInside:) forControlEvents:UIControlEventTouchUpInside];
  263
+            
  264
+        }
  265
+    }
  266
+}
  267
+
  268
+- (void)barButtonReceivedTouchDown:(UIButton *)sender
  269
+{
  270
+    // Get the rejistry entry for the target
  271
+    NSUInteger idx = [self.registry indexOfObjectPassingTest: ^(id dictionary, NSUInteger idx, BOOL *stop) {
  272
+                return [[dictionary objectForKey: @"barButton"] isEqual:sender];
  273
+    }];
  274
+    UIViewController *targetViewController = (UIViewController *)[[self.registry objectAtIndex:idx] objectForKey:@"target"];
  275
+    
  276
+    // If the target isn't the current viewController, transition to the new view
  277
+    if (![self.selectedViewController isEqual:targetViewController]) {
  278
+        [self transitionFromViewController:self.selectedViewController toViewController:targetViewController duration:0 options:UIViewAnimationTransitionNone animations:^{} completion:^(BOOL finished) {
  279
+            self.selectedViewController = targetViewController;
  280
+        }];
  281
+    }
  282
+}
  283
+
  284
+- (void)barButtonReceivedTouchUpInside:(UIButton *)sender
  285
+{
  286
+    // Inform delegate of button selection.
  287
+    [self performSelectorOnDelegate:@selector(scrollBar:DidTouchUpInsideBarButton:) withObject:self andObject:sender];
  288
+}
  289
+
  290
+@end
6  TPScrollBarController/AppDelegate.h
... ...
@@ -1,11 +1,9 @@
1 1
 //
2 2
 //  AppDelegate.h
3  
-//  TPScrollBarController
  3
+//  TPScrollBarControllerExample
4 4
 //
5  
-//  Created by Ben Stovold on 16/10/2011.
6  
-//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
  5
+//  Copyright 2011 Ben Stovold. All rights reserved.
7 6
 //
8  
-
9 7
 #import <UIKit/UIKit.h>
10 8
 
11 9
 @interface AppDelegate : UIResponder <UIApplicationDelegate>
20  TPScrollBarController/AppDelegate.m
... ...
@@ -1,9 +1,8 @@
1 1
 //
2 2
 //  AppDelegate.m
3  
-//  TPScrollBarController
  3
+//  TPScrollBarControllerExample
4 4
 //
5  
-//  Created by Ben Stovold on 16/10/2011.
6  
-//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
  5
+//  Copyright 2011 Ben Stovold. All rights reserved.
7 6
 //
8 7
 
9 8
 #import "AppDelegate.h"
@@ -18,11 +17,16 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
18 17
 {
19 18
     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
20 19
 
  20
+    
  21
+    // Create two view controllers for the contentView.
21 22
     TestController *c1 = [[TestController alloc] init];
22  
-    c1.title = @"Controller 1";
23 23
     TestController *c2 = [[TestController alloc] init];
24  
-    c2.title = @"Controller 2";
25 24
     
  25
+    // Label them so we can see which one is displayed.
  26
+    c1.title = @"View Controller 1";
  27
+    c2.title = @"View Controller 2";
  28
+    
  29
+    // Now create some buttons and add one of the view controllers as a target.
26 30
     UIButton *b1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
27 31
     [b1 setFrame:CGRectMake(0, 0, 100, 50)];
28 32
     [b1 setTitle:@"#1 Purple" forState:UIControlStateNormal];
@@ -48,6 +52,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
48 52
     [b4 setTitle:@"#2 Purple" forState:UIControlStateNormal];
49 53
     [b4 addTarget:c2 action:@selector(turnMePurple) forControlEvents:UIControlEventTouchUpInside];
50 54
     
  55
+    // Setup the parameters for the scroll bar controller.
51 56
     NSSet *viewControllers = [NSSet setWithObjects:c1, c2, nil];
52 57
     NSArray *buttons = [NSArray arrayWithObjects:b1, b2, bmore, b3, b4, nil];
53 58
     NSArray *pages = [NSArray arrayWithObjects: [NSNumber numberWithInt:1],
@@ -56,14 +61,17 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
56 61
                                                 [NSNumber numberWithInt:2],
57 62
                                                 [NSNumber numberWithInt:2], nil];
58 63
     
  64
+    // Initialise and set the controllers, buttons, pages
59 65
     TPScrollBarController *sbc = [[TPScrollBarController alloc] init];
60 66
     [sbc setViewControllers:viewControllers WithBarButtons:buttons onScrollBarPages:pages];
  67
+    
  68
+    // Add an example delegate.
61 69
     [sbc setDelegate:c1];
62 70
     
  71
+    // Assign TPScrollBarController as root.
63 72
     self.window.rootViewController = sbc;
64 73
     
65 74
     [self.window makeKeyAndVisible];
66  
-
67 75
     return YES;
68 76
 }
69 77
 
40  TPScrollBarController/TPScrollBarControllerExample-Info.plist
... ...
@@ -0,0 +1,40 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3
+<plist version="1.0">
  4
+<dict>
  5
+	<key>CFBundleDevelopmentRegion</key>
  6
+	<string>en</string>
  7
+	<key>CFBundleDisplayName</key>
  8
+	<string>${PRODUCT_NAME}</string>
  9
+	<key>CFBundleExecutable</key>
  10
+	<string>${EXECUTABLE_NAME}</string>
  11
+	<key>CFBundleIconFiles</key>
  12
+	<array/>
  13
+	<key>CFBundleIdentifier</key>
  14
+	<string>com.thoughtfulpixel.${PRODUCT_NAME:rfc1034identifier}</string>
  15
+	<key>CFBundleInfoDictionaryVersion</key>
  16
+	<string>6.0</string>
  17
+	<key>CFBundleName</key>
  18
+	<string>${PRODUCT_NAME}</string>
  19
+	<key>CFBundlePackageType</key>
  20
+	<string>APPL</string>
  21
+	<key>CFBundleShortVersionString</key>
  22
+	<string>1.0</string>
  23
+	<key>CFBundleSignature</key>
  24
+	<string>????</string>
  25
+	<key>CFBundleVersion</key>
  26
+	<string>1.0</string>
  27
+	<key>LSRequiresIPhoneOS</key>
  28
+	<true/>
  29
+	<key>UIRequiredDeviceCapabilities</key>
  30
+	<array>
  31
+		<string>armv7</string>
  32
+	</array>
  33
+	<key>UISupportedInterfaceOrientations</key>
  34
+	<array>
  35
+		<string>UIInterfaceOrientationPortrait</string>
  36
+		<string>UIInterfaceOrientationLandscapeLeft</string>
  37
+		<string>UIInterfaceOrientationLandscapeRight</string>
  38
+	</array>
  39
+</dict>
  40
+</plist>
14  TPScrollBarController/TPScrollBarControllerExample-Prefix.pch
... ...
@@ -0,0 +1,14 @@
  1
+//
  2
+// Prefix header for all source files of the 'TPScrollBarControllerExample' target in the 'TPScrollBarControllerExample' project
  3
+//
  4
+
  5
+#import <Availability.h>
  6
+
  7
+#ifndef __IPHONE_3_0
  8
+#warning "This project uses features only available in iOS SDK 3.0 and later."
  9
+#endif
  10
+
  11
+#ifdef __OBJC__
  12
+    #import <UIKit/UIKit.h>
  13
+    #import <Foundation/Foundation.h>
  14
+#endif
8  TPScrollBarController/TestController.h
... ...
@@ -1,14 +1,16 @@
1 1
 //
2 2
 //  TestController.h
3  
-//  TPScrollBarController
  3
+//  TPScrollBarControllerExample
4 4
 //
5  
-//  Created by Ben Stovold on 16/10/2011.
6  
-//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
  5
+//  Copyright 2011 Ben Stovold. All rights reserved.
7 6
 //
8 7
 
9 8
 #import <UIKit/UIKit.h>
10 9
 #import "TPScrollBarDelegate.h"
11 10
 
  11
+// This is an example view controller for illustration purposes,
  12
+// ie. it doesn't do anything fancy. Scroll bar delegate method just
  13
+// writes to the log.
12 14
 @interface TestController : UIViewController <TPScrollBarDelegate> {
13 15
     
14 16
 @protected
5  TPScrollBarController/TestController.m
... ...
@@ -1,9 +1,8 @@
1 1
 //
2 2
 //  TestController.m
3  
-//  TPScrollBarController
  3
+//  TPScrollBarControllerExample
4 4
 //
5  
-//  Created by Ben Stovold on 16/10/2011.
6  
-//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
  5
+//  Copyright 2011 Ben Stovold. All rights reserved.
7 6
 //
8 7
 
9 8
 #import "TestController.h"
5  TPScrollBarController/main.m
... ...
@@ -1,9 +1,8 @@
1 1
 //
2 2
 //  main.m
3  
-//  TPScrollBarController
  3
+//  TPScrollBarControllerExample
4 4
 //
5  
-//  Created by Ben Stovold on 16/10/2011.
6  
-//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
  5
+//  Copyright 2011 Ben Stovold. All rights reserved.
7 6
 //
8 7
 
9 8
 #import <UIKit/UIKit.h>
291  TPScrollBarControllerExample.xcodeproj/project.pbxproj
... ...
@@ -0,0 +1,291 @@
  1
+// !$*UTF8*$!
  2
+{
  3
+	archiveVersion = 1;
  4
+	classes = {
  5
+	};
  6
+	objectVersion = 46;
  7
+	objects = {
  8
+
  9
+/* Begin PBXBuildFile section */
  10
+		9F473409144C8E6D001A3CEA /* TPScrollBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F473407144C8E6D001A3CEA /* TPScrollBarController.m */; };
  11
+		9FFD3D6C144AE7EA009AE40F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FFD3D6B144AE7EA009AE40F /* UIKit.framework */; };
  12
+		9FFD3D6E144AE7EA009AE40F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FFD3D6D144AE7EA009AE40F /* Foundation.framework */; };
  13
+		9FFD3D70144AE7EA009AE40F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FFD3D6F144AE7EA009AE40F /* CoreGraphics.framework */; };
  14
+		9FFD3D76144AE7EA009AE40F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9FFD3D74144AE7EA009AE40F /* InfoPlist.strings */; };
  15
+		9FFD3D78144AE7EA009AE40F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FFD3D77144AE7EA009AE40F /* main.m */; };
  16
+		9FFD3D7C144AE7EA009AE40F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FFD3D7B144AE7EA009AE40F /* AppDelegate.m */; };
  17
+		9FFD3D89144B0954009AE40F /* TestController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FFD3D87144B0954009AE40F /* TestController.m */; };
  18
+		9FFD3D8A144B0954009AE40F /* TestController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FFD3D88144B0954009AE40F /* TestController.xib */; };
  19
+/* End PBXBuildFile section */
  20
+
  21
+/* Begin PBXFileReference section */
  22
+		9F473406144C8E6D001A3CEA /* TPScrollBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPScrollBarController.h; sourceTree = SOURCE_ROOT; };
  23
+		9F473407144C8E6D001A3CEA /* TPScrollBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TPScrollBarController.m; sourceTree = SOURCE_ROOT; };
  24
+		9F473408144C8E6D001A3CEA /* TPScrollBarDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPScrollBarDelegate.h; sourceTree = SOURCE_ROOT; };
  25
+		9FFD3D67144AE7EA009AE40F /* TPScrollBarControllerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TPScrollBarControllerExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
  26
+		9FFD3D6B144AE7EA009AE40F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
  27
+		9FFD3D6D144AE7EA009AE40F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
  28
+		9FFD3D6F144AE7EA009AE40F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
  29
+		9FFD3D73144AE7EA009AE40F /* TPScrollBarControllerExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TPScrollBarControllerExample-Info.plist"; sourceTree = "<group>"; };
  30
+		9FFD3D75144AE7EA009AE40F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
  31
+		9FFD3D77144AE7EA009AE40F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
  32
+		9FFD3D79144AE7EA009AE40F /* TPScrollBarControllerExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TPScrollBarControllerExample-Prefix.pch"; sourceTree = "<group>"; };
  33
+		9FFD3D7A144AE7EA009AE40F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
  34
+		9FFD3D7B144AE7EA009AE40F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
  35
+		9FFD3D86144B0954009AE40F /* TestController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestController.h; sourceTree = "<group>"; };
  36
+		9FFD3D87144B0954009AE40F /* TestController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestController.m; sourceTree = "<group>"; };
  37
+		9FFD3D88144B0954009AE40F /* TestController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TestController.xib; sourceTree = "<group>"; };
  38
+/* End PBXFileReference section */
  39
+
  40
+/* Begin PBXFrameworksBuildPhase section */
  41
+		9FFD3D64144AE7EA009AE40F /* Frameworks */ = {
  42
+			isa = PBXFrameworksBuildPhase;
  43
+			buildActionMask = 2147483647;
  44
+			files = (
  45
+				9FFD3D6C144AE7EA009AE40F /* UIKit.framework in Frameworks */,
  46
+				9FFD3D6E144AE7EA009AE40F /* Foundation.framework in Frameworks */,
  47
+				9FFD3D70144AE7EA009AE40F /* CoreGraphics.framework in Frameworks */,
  48
+			);
  49
+			runOnlyForDeploymentPostprocessing = 0;
  50
+		};
  51
+/* End PBXFrameworksBuildPhase section */
  52
+
  53
+/* Begin PBXGroup section */
  54
+		9F473405144C8DCE001A3CEA /* TPScrollBarController */ = {
  55
+			isa = PBXGroup;
  56
+			children = (
  57
+				9F473406144C8E6D001A3CEA /* TPScrollBarController.h */,
  58
+				9F473407144C8E6D001A3CEA /* TPScrollBarController.m */,
  59
+				9F473408144C8E6D001A3CEA /* TPScrollBarDelegate.h */,
  60
+			);
  61
+			name = TPScrollBarController;
  62
+			sourceTree = "<group>";
  63
+		};
  64
+		9FFD3D5C144AE7EA009AE40F = {
  65
+			isa = PBXGroup;
  66
+			children = (
  67
+				9FFD3D71144AE7EA009AE40F /* TPScrollBarControllerExample */,
  68
+				9FFD3D6A144AE7EA009AE40F /* Frameworks */,
  69
+				9FFD3D68144AE7EA009AE40F /* Products */,
  70
+			);
  71
+			sourceTree = "<group>";
  72
+		};
  73
+		9FFD3D68144AE7EA009AE40F /* Products */ = {
  74
+			isa = PBXGroup;
  75
+			children = (
  76
+				9FFD3D67144AE7EA009AE40F /* TPScrollBarControllerExample.app */,
  77
+			);
  78
+			name = Products;
  79
+			sourceTree = "<group>";
  80
+		};
  81
+		9FFD3D6A144AE7EA009AE40F /* Frameworks */ = {
  82
+			isa = PBXGroup;
  83
+			children = (
  84
+				9FFD3D6B144AE7EA009AE40F /* UIKit.framework */,
  85
+				9FFD3D6D144AE7EA009AE40F /* Foundation.framework */,
  86
+				9FFD3D6F144AE7EA009AE40F /* CoreGraphics.framework */,
  87
+			);
  88
+			name = Frameworks;
  89
+			sourceTree = "<group>";
  90
+		};
  91
+		9FFD3D71144AE7EA009AE40F /* TPScrollBarControllerExample */ = {
  92
+			isa = PBXGroup;
  93
+			children = (
  94
+				9F473405144C8DCE001A3CEA /* TPScrollBarController */,
  95
+				9FFD3D7A144AE7EA009AE40F /* AppDelegate.h */,
  96
+				9FFD3D7B144AE7EA009AE40F /* AppDelegate.m */,
  97
+				9FFD3D86144B0954009AE40F /* TestController.h */,
  98
+				9FFD3D87144B0954009AE40F /* TestController.m */,
  99
+				9FFD3D88144B0954009AE40F /* TestController.xib */,
  100
+				9FFD3D72144AE7EA009AE40F /* Supporting Files */,
  101
+			);
  102
+			name = TPScrollBarControllerExample;
  103
+			path = TPScrollBarController;
  104
+			sourceTree = "<group>";
  105
+		};
  106
+		9FFD3D72144AE7EA009AE40F /* Supporting Files */ = {
  107
+			isa = PBXGroup;
  108
+			children = (
  109
+				9FFD3D73144AE7EA009AE40F /* TPScrollBarControllerExample-Info.plist */,
  110
+				9FFD3D74144AE7EA009AE40F /* InfoPlist.strings */,
  111
+				9FFD3D77144AE7EA009AE40F /* main.m */,
  112
+				9FFD3D79144AE7EA009AE40F /* TPScrollBarControllerExample-Prefix.pch */,
  113
+			);
  114
+			name = "Supporting Files";
  115
+			sourceTree = "<group>";
  116
+		};
  117
+/* End PBXGroup section */
  118
+
  119
+/* Begin PBXNativeTarget section */
  120
+		9FFD3D66144AE7EA009AE40F /* TPScrollBarControllerExample */ = {
  121
+			isa = PBXNativeTarget;
  122
+			buildConfigurationList = 9FFD3D7F144AE7EA009AE40F /* Build configuration list for PBXNativeTarget "TPScrollBarControllerExample" */;
  123
+			buildPhases = (
  124
+				9FFD3D63144AE7EA009AE40F /* Sources */,
  125
+				9FFD3D64144AE7EA009AE40F /* Frameworks */,
  126
+				9FFD3D65144AE7EA009AE40F /* Resources */,
  127
+			);
  128
+			buildRules = (
  129
+			);
  130
+			dependencies = (
  131
+			);
  132
+			name = TPScrollBarControllerExample;
  133
+			productName = TPScrollBarController;
  134
+			productReference = 9FFD3D67144AE7EA009AE40F /* TPScrollBarControllerExample.app */;
  135
+			productType = "com.apple.product-type.application";
  136
+		};
  137
+/* End PBXNativeTarget section */
  138
+
  139
+/* Begin PBXProject section */
  140
+		9FFD3D5E144AE7EA009AE40F /* Project object */ = {
  141
+			isa = PBXProject;
  142
+			attributes = {
  143
+				LastUpgradeCheck = 0420;
  144
+			};
  145
+			buildConfigurationList = 9FFD3D61144AE7EA009AE40F /* Build configuration list for PBXProject "TPScrollBarControllerExample" */;
  146
+			compatibilityVersion = "Xcode 3.2";
  147
+			developmentRegion = English;
  148
+			hasScannedForEncodings = 0;
  149
+			knownRegions = (
  150
+				en,
  151
+			);
  152
+			mainGroup = 9FFD3D5C144AE7EA009AE40F;
  153
+			productRefGroup = 9FFD3D68144AE7EA009AE40F /* Products */;
  154
+			projectDirPath = "";
  155
+			projectRoot = "";
  156
+			targets = (
  157
+				9FFD3D66144AE7EA009AE40F /* TPScrollBarControllerExample */,
  158
+			);
  159
+		};
  160
+/* End PBXProject section */
  161
+
  162
+/* Begin PBXResourcesBuildPhase section */
  163
+		9FFD3D65144AE7EA009AE40F /* Resources */ = {
  164
+			isa = PBXResourcesBuildPhase;
  165
+			buildActionMask = 2147483647;
  166
+			files = (
  167
+				9FFD3D76144AE7EA009AE40F /* InfoPlist.strings in Resources */,
  168
+				9FFD3D8A144B0954009AE40F /* TestController.xib in Resources */,
  169
+			);
  170
+			runOnlyForDeploymentPostprocessing = 0;
  171
+		};
  172
+/* End PBXResourcesBuildPhase section */
  173
+
  174
+/* Begin PBXSourcesBuildPhase section */
  175
+		9FFD3D63144AE7EA009AE40F /* Sources */ = {
  176
+			isa = PBXSourcesBuildPhase;
  177
+			buildActionMask = 2147483647;
  178
+			files = (
  179
+				9FFD3D78144AE7EA009AE40F /* main.m in Sources */,
  180
+				9FFD3D7C144AE7EA009AE40F /* AppDelegate.m in Sources */,
  181
+				9FFD3D89144B0954009AE40F /* TestController.m in Sources */,
  182
+				9F473409144C8E6D001A3CEA /* TPScrollBarController.m in Sources */,
  183
+			);
  184
+			runOnlyForDeploymentPostprocessing = 0;
  185
+		};
  186
+/* End PBXSourcesBuildPhase section */
  187
+
  188
+/* Begin PBXVariantGroup section */
  189
+		9FFD3D74144AE7EA009AE40F /* InfoPlist.strings */ = {
  190
+			isa = PBXVariantGroup;
  191
+			children = (
  192
+				9FFD3D75144AE7EA009AE40F /* en */,
  193
+			);
  194
+			name = InfoPlist.strings;
  195
+			sourceTree = "<group>";
  196
+		};
  197
+/* End PBXVariantGroup section */
  198
+
  199
+/* Begin XCBuildConfiguration section */
  200
+		9FFD3D7D144AE7EA009AE40F /* Debug */ = {
  201
+			isa = XCBuildConfiguration;
  202
+			buildSettings = {
  203
+				ALWAYS_SEARCH_USER_PATHS = NO;
  204
+				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
  205
+				CLANG_ENABLE_OBJC_ARC = YES;
  206
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
  207
+				COPY_PHASE_STRIP = NO;
  208
+				GCC_C_LANGUAGE_STANDARD = gnu99;
  209
+				GCC_DYNAMIC_NO_PIC = NO;
  210
+				GCC_OPTIMIZATION_LEVEL = 0;
  211
+				GCC_PREPROCESSOR_DEFINITIONS = (
  212
+					"DEBUG=1",
  213
+					"$(inherited)",
  214
+				);
  215
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
  216
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
  217
+				GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
  218
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
  219
+				GCC_WARN_UNUSED_VARIABLE = YES;
  220
+				IPHONEOS_DEPLOYMENT_TARGET = 5.0;
  221
+				SDKROOT = iphoneos;
  222
+			};
  223
+			name = Debug;
  224
+		};
  225
+		9FFD3D7E144AE7EA009AE40F /* Release */ = {
  226
+			isa = XCBuildConfiguration;
  227
+			buildSettings = {
  228
+				ALWAYS_SEARCH_USER_PATHS = NO;
  229
+				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
  230
+				CLANG_ENABLE_OBJC_ARC = YES;
  231
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
  232
+				COPY_PHASE_STRIP = YES;
  233
+				GCC_C_LANGUAGE_STANDARD = gnu99;
  234
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
  235
+				GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
  236
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
  237
+				GCC_WARN_UNUSED_VARIABLE = YES;
  238
+				IPHONEOS_DEPLOYMENT_TARGET = 5.0;
  239
+				OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
  240
+				SDKROOT = iphoneos;
  241
+				VALIDATE_PRODUCT = YES;
  242
+			};
  243
+			name = Release;
  244
+		};
  245
+		9FFD3D80144AE7EA009AE40F /* Debug */ = {
  246
+			isa = XCBuildConfiguration;
  247
+			buildSettings = {
  248
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
  249
+				GCC_PREFIX_HEADER = "TPScrollBarController/TPScrollBarControllerExample-Prefix.pch";
  250
+				INFOPLIST_FILE = "TPScrollBarController/TPScrollBarControllerExample-Info.plist";
  251
+				PRODUCT_NAME = TPScrollBarControllerExample;
  252
+				WRAPPER_EXTENSION = app;
  253
+			};
  254
+			name = Debug;
  255
+		};
  256
+		9FFD3D81144AE7EA009AE40F /* Release */ = {
  257
+			isa = XCBuildConfiguration;
  258
+			buildSettings = {
  259
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
  260
+				GCC_PREFIX_HEADER = "TPScrollBarController/TPScrollBarControllerExample-Prefix.pch";
  261
+				INFOPLIST_FILE = "TPScrollBarController/TPScrollBarControllerExample-Info.plist";
  262
+				PRODUCT_NAME = TPScrollBarControllerExample;
  263
+				WRAPPER_EXTENSION = app;
  264
+			};
  265
+			name = Release;
  266
+		};
  267
+/* End XCBuildConfiguration section */
  268
+
  269
+/* Begin XCConfigurationList section */
  270
+		9FFD3D61144AE7EA009AE40F /* Build configuration list for PBXProject "TPScrollBarControllerExample" */ = {
  271
+			isa = XCConfigurationList;
  272
+			buildConfigurations = (
  273
+				9FFD3D7D144AE7EA009AE40F /* Debug */,
  274
+				9FFD3D7E144AE7EA009AE40F /* Release */,
  275
+			);
  276
+			defaultConfigurationIsVisible = 0;
  277
+			defaultConfigurationName = Release;
  278
+		};
  279
+		9FFD3D7F144AE7EA009AE40F /* Build configuration list for PBXNativeTarget "TPScrollBarControllerExample" */ = {
  280
+			isa = XCConfigurationList;
  281
+			buildConfigurations = (
  282
+				9FFD3D80144AE7EA009AE40F /* Debug */,
  283
+				9FFD3D81144AE7EA009AE40F /* Release */,
  284
+			);
  285
+			defaultConfigurationIsVisible = 0;
  286
+			defaultConfigurationName = Release;
  287
+		};
  288
+/* End XCConfigurationList section */
  289
+	};
  290
+	rootObject = 9FFD3D5E144AE7EA009AE40F /* Project object */;
  291
+}
12  TPScrollBarDelegate.h
... ...
@@ -0,0 +1,12 @@
  1
+//
  2
+//  TPScrollBarDelegate.h
  3
+//  TPScrollBarController
  4
+//
  5
+//  Copyright 2011 Ben Stovold. All rights reserved.
  6
+//
  7
+
  8
+@protocol TPScrollBarDelegate <NSObject>
  9
+
  10
+- (void)scrollBar:(id)scrollBarController DidTouchUpInsideBarButton:(UIButton *)barButton;
  11
+
  12
+@end

0 notes on commit 6eba0c2

Please sign in to comment.
Something went wrong with that request. Please try again.