Skip to content

Commit

Permalink
init project
Browse files Browse the repository at this point in the history
  • Loading branch information
smartwalle committed Aug 19, 2015
0 parents commit d7ac55f
Show file tree
Hide file tree
Showing 32 changed files with 2,402 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
456 changes: 456 additions & 0 deletions KIPageView.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

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,10 @@
<?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>HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key>
<true/>
<key>SnapshotAutomaticallyBeforeSignificantChanges</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0640"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D5C4B2141B84B4B100A8792B"
BuildableName = "KIPageView.app"
BlueprintName = "KIPageView"
ReferencedContainer = "container:KIPageView.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D5C4B22D1B84B4B100A8792B"
BuildableName = "KIPageViewTests.xctest"
BlueprintName = "KIPageViewTests"
ReferencedContainer = "container:KIPageView.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D5C4B22D1B84B4B100A8792B"
BuildableName = "KIPageViewTests.xctest"
BlueprintName = "KIPageViewTests"
ReferencedContainer = "container:KIPageView.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D5C4B2141B84B4B100A8792B"
BuildableName = "KIPageView.app"
BlueprintName = "KIPageView"
ReferencedContainer = "container:KIPageView.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
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D5C4B2141B84B4B100A8792B"
BuildableName = "KIPageView.app"
BlueprintName = "KIPageView"
ReferencedContainer = "container:KIPageView.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D5C4B2141B84B4B100A8792B"
BuildableName = "KIPageView.app"
BlueprintName = "KIPageView"
ReferencedContainer = "container:KIPageView.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,27 @@
<?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>KIPageView.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>D5C4B2141B84B4B100A8792B</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>D5C4B22D1B84B4B100A8792B</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
19 changes: 19 additions & 0 deletions KIPageView/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// AppDelegate.h
// KIPageView
//
// Created by SmartWalle on 15/8/19.
// Copyright (c) 2015年 SmartWalle. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "RootViewController.h"

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong) RootViewController *rootViewController;


@end

64 changes: 64 additions & 0 deletions KIPageView/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// AppDelegate.m
// KIPageView
//
// Created by SmartWalle on 15/8/19.
// Copyright (c) 2015年 SmartWalle. All rights reserved.
//

#import "AppDelegate.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self.rootViewController];
[self.window setRootViewController:navController];
[self.window makeKeyAndVisible];
return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
// 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.
// 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.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
// 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.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
// 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.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
// 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.
}

- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

#pragma mark - Getters and setters
- (UIWindow *)window {
if (_window == nil) {
CGRect bounds = [UIScreen mainScreen].bounds;
_window = [[UIWindow alloc] initWithFrame:bounds];
[_window setBackgroundColor:[UIColor whiteColor]];
}
return _window;
}

- (RootViewController *)rootViewController {
if (_rootViewController == nil) {
_rootViewController = [[RootViewController alloc] initWithStyle:UITableViewStylePlain];
}
return _rootViewController;
}

@end
18 changes: 18 additions & 0 deletions KIPageView/BaseViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// BaseViewController.h
// KIPageView
//
// Created by SmartWalle on 15/8/19.
// Copyright (c) 2015年 SmartWalle. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "KIPageView.h"

@interface BaseViewController : UIViewController <KIPageViewDelegate> {
KIPageView *_pageView;
}

@property (nonatomic, strong) KIPageView *pageView;
@property (nonatomic, strong) NSMutableArray *dataSource;
@end
95 changes: 95 additions & 0 deletions KIPageView/BaseViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
//
// BaseViewController.m
// KIPageView
//
// Created by SmartWalle on 15/8/19.
// Copyright (c) 2015年 SmartWalle. All rights reserved.
//

#import "BaseViewController.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)loadView {
[super loadView];
[self.view setBackgroundColor:[UIColor whiteColor]];
}

- (void)viewDidLoad {
[super viewDidLoad];

[self setEdgesForExtendedLayout:UIRectEdgeNone];

[self.view addSubview:self.pageView];

[self layoutSubviews];
}

#pragma mark - Methods
- (void)layoutSubviews {

[self.pageView setTranslatesAutoresizingMaskIntoConstraints:NO];

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
[self.pageView setLayoutMargins:UIEdgeInsetsZero];
}

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.pageView
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:10]];

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.pageView
attribute:NSLayoutAttributeLeftMargin
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:10]];

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.pageView
attribute:NSLayoutAttributeRightMargin
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeRight
multiplier:1.0
constant:-10]];

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.pageView
attribute:NSLayoutAttributeBottomMargin
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeBottom
multiplier:1.0
constant:-10]];
}

#pragma mark - Getters and setters
- (KIPageView *)pageView {
if (_pageView == nil) {
_pageView = [[KIPageView alloc] init];
[_pageView setBackgroundColor:[UIColor whiteColor]];
[_pageView setDelegate:self];
[_pageView setItemMargin:10];
}
return _pageView;
}

- (NSMutableArray *)dataSource {
if (_dataSource == nil) {
_dataSource = [[NSMutableArray alloc] init];
for (int i=0; i<20; i++) {
[_dataSource addObject:[NSString stringWithFormat:@"这是第 %d", i]];
}
}
return _dataSource;
}

@end
14 changes: 14 additions & 0 deletions KIPageView/HorizontalListViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// HorizontalListViewController.h
// KIPageView
//
// Created by SmartWalle on 15/8/19.
// Copyright (c) 2015年 SmartWalle. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "BaseViewController.h"

@interface HorizontalListViewController : BaseViewController

@end
Loading

0 comments on commit d7ac55f

Please sign in to comment.