Permalink
Browse files

First Commit

  • Loading branch information...
junpluse committed May 8, 2011
1 parent 9ae0a64 commit 51651f964c8a1c56681477bb4b21372467080ba5
@@ -14,20 +14,27 @@
BF60EB9B1374000700B0603C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BF60EB9A1374000700B0603C /* main.m */; };
BF60EB9E1374000700B0603C /* JTListViewAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BF60EB9D1374000700B0603C /* JTListViewAppDelegate.m */; };
BF60EBA11374000700B0603C /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF60EB9F1374000700B0603C /* MainWindow.xib */; };
+ BF60EBD6137400E800B0603C /* JTListView.m in Sources */ = {isa = PBXBuildFile; fileRef = BF60EBD5137400E800B0603C /* JTListView.m */; };
+ BFB77303137670EC00983A93 /* JTListViewDemoController.m in Sources */ = {isa = PBXBuildFile; fileRef = BFB77302137670EC00983A93 /* JTListViewDemoController.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
BF60EB891374000600B0603C /* JTListView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JTListView.app; sourceTree = BUILT_PRODUCTS_DIR; };
BF60EB8D1374000600B0603C /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
BF60EB8F1374000700B0603C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
BF60EB911374000700B0603C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
- BF60EB951374000700B0603C /* JTListView-Info.plist */ = {isa = PBXFileReference; path = "JTListView-Info.plist"; sourceTree = "<group>"; };
+ BF60EB951374000700B0603C /* JTListView-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "JTListView-Info.plist"; sourceTree = "<group>"; };
BF60EB971374000700B0603C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
- BF60EB991374000700B0603C /* JTListView-Prefix.pch */ = {isa = PBXFileReference; path = "JTListView-Prefix.pch"; sourceTree = "<group>"; };
+ BF60EB991374000700B0603C /* JTListView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JTListView-Prefix.pch"; sourceTree = "<group>"; };
BF60EB9A1374000700B0603C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
- BF60EB9C1374000700B0603C /* JTListViewAppDelegate.h */ = {isa = PBXFileReference; path = JTListViewAppDelegate.h; sourceTree = "<group>"; };
+ BF60EB9C1374000700B0603C /* JTListViewAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JTListViewAppDelegate.h; sourceTree = "<group>"; };
BF60EB9D1374000700B0603C /* JTListViewAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JTListViewAppDelegate.m; sourceTree = "<group>"; };
BF60EBA01374000700B0603C /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = "<group>"; };
+ BF60EBD4137400E800B0603C /* JTListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JTListView.h; sourceTree = "<group>"; };
+ BF60EBD5137400E800B0603C /* JTListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JTListView.m; sourceTree = "<group>"; };
+ BFB77301137670EC00983A93 /* JTListViewDemoController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JTListViewDemoController.h; sourceTree = "<group>"; };
+ BFB77302137670EC00983A93 /* JTListViewDemoController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JTListViewDemoController.m; sourceTree = "<group>"; };
+ BFB773321376F3ED00983A93 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -76,6 +83,10 @@
children = (
BF60EB9C1374000700B0603C /* JTListViewAppDelegate.h */,
BF60EB9D1374000700B0603C /* JTListViewAppDelegate.m */,
+ BFB77301137670EC00983A93 /* JTListViewDemoController.h */,
+ BFB77302137670EC00983A93 /* JTListViewDemoController.m */,
+ BF60EBD4137400E800B0603C /* JTListView.h */,
+ BF60EBD5137400E800B0603C /* JTListView.m */,
BF60EB9F1374000700B0603C /* MainWindow.xib */,
BF60EB941374000700B0603C /* Supporting Files */,
);
@@ -89,6 +100,7 @@
BF60EB961374000700B0603C /* InfoPlist.strings */,
BF60EB991374000700B0603C /* JTListView-Prefix.pch */,
BF60EB9A1374000700B0603C /* main.m */,
+ BFB773321376F3ED00983A93 /* .gitignore */,
);
name = "Supporting Files";
sourceTree = "<group>";
@@ -119,7 +131,7 @@
BF60EB801374000600B0603C /* Project object */ = {
isa = PBXProject;
attributes = {
- ORGANIZATIONNAME = "東京工科大学";
+ ORGANIZATIONNAME = "Jun Tanaka";
};
buildConfigurationList = BF60EB831374000600B0603C /* Build configuration list for PBXProject "JTListView" */;
compatibilityVersion = "Xcode 3.2";
@@ -157,6 +169,8 @@
files = (
BF60EB9B1374000700B0603C /* main.m in Sources */,
BF60EB9E1374000700B0603C /* JTListViewAppDelegate.m in Sources */,
+ BF60EBD6137400E800B0603C /* JTListView.m in Sources */,
+ BFB77303137670EC00983A93 /* JTListViewDemoController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -186,6 +200,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -195,6 +210,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ PROVISIONING_PROFILE = "";
SDKROOT = iphoneos;
};
name = Debug;
@@ -203,13 +219,15 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ PROVISIONING_PROFILE = "";
SDKROOT = iphoneos;
};
name = Release;
@@ -223,7 +241,9 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "JTListView/JTListView-Prefix.pch";
INFOPLIST_FILE = "JTListView/JTListView-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = "$(TARGET_NAME)";
+ TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
name = Debug;
@@ -236,7 +256,9 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "JTListView/JTListView-Prefix.pch";
INFOPLIST_FILE = "JTListView/JTListView-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = "$(TARGET_NAME)";
+ TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
WRAPPER_EXTENSION = app;
};
@@ -261,6 +283,7 @@
BF60EBA61374000700B0603C /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
@@ -4,6 +4,22 @@
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "BF60EB881374000600B0603C"
+ BuildableName = "JTListView.app"
+ BlueprintName = "JTListView"
+ ReferencedContainer = "container:JTListView.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
@@ -21,6 +37,15 @@
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "BF60EB881374000600B0603C"
+ BuildableName = "JTListView.app"
+ BlueprintName = "JTListView"
+ ReferencedContainer = "container:JTListView.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
@@ -31,6 +56,15 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "BF60EB881374000600B0603C"
+ BuildableName = "JTListView.app"
+ BlueprintName = "JTListView"
+ ReferencedContainer = "container:JTListView.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
View
@@ -0,0 +1,14 @@
+# Xcode
+build/*
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+*.xcworkspace
+!default.xcworkspace
+profile
+*.moved-aside
@@ -31,6 +31,7 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
View
@@ -0,0 +1,102 @@
+//
+// JTListView.h
+// JTListView
+//
+// Created by Jun on 5/6/11.
+// Copyright 2011 Jun Tanaka. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+@class JTListView;
+
+
+typedef enum {
+ JTListViewLayoutLeftToRight,
+ JTListViewLayoutRightToLeft,
+ JTListViewLayoutTopToBottom,
+ JTListViewLayoutBottomToTop
+} JTListViewLayout;
+
+
+typedef enum {
+ JTListViewScrollPositionNone = UITableViewScrollPositionNone,
+ JTListViewScrollPositionCenter = UITableViewRowAnimationMiddle,
+ JTListViewScrollPositionCenterElseNone // center if the view size is smaller than bounds size, else none
+} JTListViewScrollPosition;
+
+
+@protocol JTListViewDataSource <NSObject>
+@required
+- (NSUInteger)numberOfItemsInListView:(JTListView *)listView;
+- (UIView *)listView:(JTListView *)listView viewForItemAtIndex:(NSUInteger)index;
+
+@end
+
+
+@protocol JTListViewDelegate <UIScrollViewDelegate>
+@optional
+- (void)listView:(JTListView *)listView willDisplayView:(UIView *)view forItemAtIndex:(NSUInteger)index;
+
+- (CGFloat)listView:(JTListView *)listView widthForItemAtIndex:(NSUInteger)index; // for horizontal layouts
+- (CGFloat)listView:(JTListView *)listView heightForItemAtIndex:(NSUInteger)index; // for vertical layouts
+
+@end
+
+
+@interface JTListView : UIScrollView {
+@package
+ NSMutableArray *_itemRects;
+ NSRange _visibleRange;
+ NSMutableArray *_visibleViews;
+ NSMutableSet *_reuseableViews;
+}
+
+@property (nonatomic, assign) IBOutlet id <JTListViewDataSource> dataSource;
+@property (nonatomic, assign) IBOutlet id <JTListViewDelegate> delegate;
+
+@property (nonatomic) JTListViewLayout layout;
+@property (nonatomic) CGFloat itemWidth; // for horizontal layouts. default is 44.0
+@property (nonatomic) CGFloat itemHeight; // for vertical layouts. default is 44.0
+@property (nonatomic) CGFloat gapBetweenItems; // default is zero
+@property (nonatomic) UIEdgeInsets visibleInsets; // set negative values to load views outside bounds. default is UIEdgeInsetsZero
+
+- (id)initWithFrame:(CGRect)frame layout:(JTListViewLayout)layout; // must specify style at creation. -initWithFrame: calls this with JTListViewLayoutLeftToRight
+
+- (void)reloadData;
+- (void)reloadItemsAtIndexes:(NSIndexSet *)indexes;
+
+- (void)updateItemSizes;
+- (void)updateItemSizesAtIndexes:(NSIndexSet *)indexes;
+
+- (NSUInteger)numberOfItems;
+
+- (CGRect)rectForItemAtIndex:(NSUInteger)index; // returns CGRectNull if index is out of range
+- (UIView *)viewForItemAtIndex:(NSUInteger)index; // returns nil if view is not visible or index is out of range
+
+- (NSUInteger)indexForView:(UIView *)view; // returns NSNotFound if view is not visible
+- (NSUInteger)indexForItemAtPoint:(CGPoint)point; // returns NSNotFound if point is outside list
+- (NSUInteger)indexForItemAtCenterOfBounds;
+- (NSIndexSet *)indexesForItemsInRect:(CGRect)rect; // returns nil if rect is outside list
+
+- (CGRect)visibleRect;
+- (NSArray *)visibleViews;
+- (NSIndexSet *)indexesForVisibleItems;
+
+- (void)scrollToItemAtIndex:(NSUInteger)index atScrollPosition:(JTListViewScrollPosition)scrollPosition animated:(BOOL)animated;
+
+// smart paging
+- (void)goBack:(BOOL)animated;
+- (void)goForward:(BOOL)animated;
+
+- (UIView *)dequeueReusableView; // similar to UITableView's dequeueReusableCellWithIdentifier:
+
+@end
+
+
+@interface JTListViewController : UIViewController <JTListViewDataSource, JTListViewDelegate>
+
+@property (nonatomic, retain) IBOutlet JTListView *listView;
+
+@end
Oops, something went wrong.

0 comments on commit 51651f9

Please sign in to comment.