Skip to content

Commit 93f8676

Browse files
committed
Initial commit with working implementation.
1 parent d16921c commit 93f8676

20 files changed

+1195
-0
lines changed

PDTiledView.xcodeproj/project.pbxproj

Lines changed: 495 additions & 0 deletions
Large diffs are not rendered by default.

PDTiledView/[email protected]

18.2 KB
Loading

PDTiledView/Default.png

6.39 KB
Loading

PDTiledView/[email protected]

15.7 KB
Loading

PDTiledView/PDAppDelegate.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// PDAppDelegate.h
3+
// PDTiledView
4+
//
5+
// Created by Parker Wightman on 12/12/12.
6+
// Copyright (c) 2012 Parker Wightman Inc. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface PDAppDelegate : UIResponder <UIApplicationDelegate>
12+
13+
@property (strong, nonatomic) UIWindow *window;
14+
15+
@end

PDTiledView/PDAppDelegate.m

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// PDAppDelegate.m
3+
// PDTiledView
4+
//
5+
// Created by Parker Wightman on 12/12/12.
6+
// Copyright (c) 2012 Parker Wightman Inc. All rights reserved.
7+
//
8+
9+
#import "PDAppDelegate.h"
10+
11+
@implementation PDAppDelegate
12+
13+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
14+
{
15+
// Override point for customization after application launch.
16+
return YES;
17+
}
18+
19+
- (void)applicationWillResignActive:(UIApplication *)application
20+
{
21+
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
22+
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
23+
}
24+
25+
- (void)applicationDidEnterBackground:(UIApplication *)application
26+
{
27+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
28+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
29+
}
30+
31+
- (void)applicationWillEnterForeground:(UIApplication *)application
32+
{
33+
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34+
}
35+
36+
- (void)applicationDidBecomeActive:(UIApplication *)application
37+
{
38+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
39+
}
40+
41+
- (void)applicationWillTerminate:(UIApplication *)application
42+
{
43+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
44+
}
45+
46+
@end

PDTiledView/PDTiledView-Info.plist

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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>CFBundleIdentifier</key>
12+
<string>pwightman.${PRODUCT_NAME:rfc1034identifier}</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>${PRODUCT_NAME}</string>
17+
<key>CFBundlePackageType</key>
18+
<string>APPL</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>1.0</string>
21+
<key>CFBundleSignature</key>
22+
<string>????</string>
23+
<key>CFBundleVersion</key>
24+
<string>1.0</string>
25+
<key>LSRequiresIPhoneOS</key>
26+
<true/>
27+
<key>UIMainStoryboardFile</key>
28+
<string>MainStoryboard_iPhone</string>
29+
<key>UIMainStoryboardFile~ipad</key>
30+
<string>MainStoryboard_iPad</string>
31+
<key>UIRequiredDeviceCapabilities</key>
32+
<array>
33+
<string>armv7</string>
34+
</array>
35+
<key>UISupportedInterfaceOrientations</key>
36+
<array>
37+
<string>UIInterfaceOrientationPortrait</string>
38+
<string>UIInterfaceOrientationLandscapeLeft</string>
39+
<string>UIInterfaceOrientationLandscapeRight</string>
40+
</array>
41+
<key>UISupportedInterfaceOrientations~ipad</key>
42+
<array>
43+
<string>UIInterfaceOrientationPortrait</string>
44+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
45+
<string>UIInterfaceOrientationLandscapeLeft</string>
46+
<string>UIInterfaceOrientationLandscapeRight</string>
47+
</array>
48+
</dict>
49+
</plist>

PDTiledView/PDTiledView-Prefix.pch

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// Prefix header for all source files of the 'PDTiledView' target in the 'PDTiledView' project
3+
//
4+
5+
#import <Availability.h>
6+
7+
#ifndef __IPHONE_5_0
8+
#warning "This project uses features only available in iOS SDK 5.0 and later."
9+
#endif
10+
11+
#ifdef __OBJC__
12+
#import <UIKit/UIKit.h>
13+
#import <Foundation/Foundation.h>
14+
#endif
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//
2+
// PDTiledView.h
3+
// PDTiledView
4+
//
5+
// Created by Parker Wightman on 12/12/12.
6+
// Copyright (c) 2012 Parker Wightman Inc. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
struct PDIndexPath {
12+
NSInteger section;
13+
NSInteger tile;
14+
};
15+
typedef struct PDIndexPath PDIndexPath;
16+
17+
CG_INLINE
18+
PDIndexPath PDIndexPathMake(NSInteger section, NSInteger tile) {
19+
PDIndexPath indexPath;
20+
indexPath.section = section;
21+
indexPath.tile = tile;
22+
23+
return indexPath;
24+
}
25+
26+
@interface PDTiledView : UIView
27+
28+
#pragma Required Blocks
29+
@property (strong, nonatomic) NSInteger (^numberOfSectionsBlock)();
30+
@property (strong, nonatomic) NSInteger (^numberOfTilesInSectionBlock)(NSInteger section);
31+
@property (strong, nonatomic) UIControl* (^controlForSectionBlock)(NSInteger section);
32+
@property (strong, nonatomic) UIControl* (^controlForIndexPathBlock)(PDIndexPath indexPath);
33+
34+
#pragma Optional Blocks
35+
// Default is the width of this PDTiledView, so it will be square
36+
@property (strong, nonatomic) CGFloat (^heightForSectionControlBlock)();
37+
// Default is the width of this PDTiledView, so it will be square
38+
@property (strong, nonatomic) CGFloat (^heightForTilesInSectionBlock)(NSInteger section);
39+
40+
@property (strong, nonatomic) void (^didSelectTileAtIndexPathBlock)(UIControl *tile, PDIndexPath indexPath);
41+
@property (strong, nonatomic) void (^didSelectSectionBlock)(UIControl *sectionControl, NSInteger section);
42+
@property (strong, nonatomic) void (^willDisplaySectionBlock)(UIControl *sectionControl, NSInteger section);
43+
@property (strong, nonatomic) void (^willDisplayTileAtIndexPathBlock)(UIControl *tile, PDIndexPath indexPath);
44+
45+
- (void) reloadData;
46+
- (void) selectSection:(NSInteger)section animated:(BOOL)animated;
47+
48+
@end

0 commit comments

Comments
 (0)