Skip to content

Commit

Permalink
CoreNewFeatureVC
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlinFeng committed Apr 27, 2015
1 parent 94111cd commit 18aedfe
Show file tree
Hide file tree
Showing 47 changed files with 3,346 additions and 44 deletions.
172 changes: 166 additions & 6 deletions CoreNewFeatureVC.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0630"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89335F5E1AEDFEE800BC444B"
BuildableName = "CoreNewFeatureVC.app"
BlueprintName = "CoreNewFeatureVC"
ReferencedContainer = "container:CoreNewFeatureVC.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89335F771AEDFEE800BC444B"
BuildableName = "CoreNewFeatureVCTests.xctest"
BlueprintName = "CoreNewFeatureVCTests"
ReferencedContainer = "container:CoreNewFeatureVC.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 = "89335F771AEDFEE800BC444B"
BuildableName = "CoreNewFeatureVCTests.xctest"
BlueprintName = "CoreNewFeatureVCTests"
ReferencedContainer = "container:CoreNewFeatureVC.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89335F5E1AEDFEE800BC444B"
BuildableName = "CoreNewFeatureVC.app"
BlueprintName = "CoreNewFeatureVC"
ReferencedContainer = "container:CoreNewFeatureVC.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 = "89335F5E1AEDFEE800BC444B"
BuildableName = "CoreNewFeatureVC.app"
BlueprintName = "CoreNewFeatureVC"
ReferencedContainer = "container:CoreNewFeatureVC.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89335F5E1AEDFEE800BC444B"
BuildableName = "CoreNewFeatureVC.app"
BlueprintName = "CoreNewFeatureVC"
ReferencedContainer = "container:CoreNewFeatureVC.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>CoreNewFeatureVC.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>89335F5E1AEDFEE800BC444B</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>89335F771AEDFEE800BC444B</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
16 changes: 15 additions & 1 deletion CoreNewFeatureVC/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
// Copyright (c) 2015年 冯成林. All rights reserved.
//


#import "AppDelegate.h"
#import "CoreNewFeatureVC.h"

@interface AppDelegate ()

Expand All @@ -16,7 +18,19 @@ @implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.

UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window = window;
NewFeatureModel *m1 = [NewFeatureModel model:[UIImage imageNamed:@"f1"]];

NewFeatureModel *m2 = [NewFeatureModel model:[UIImage imageNamed:@"f2"]];

NewFeatureModel *m3 = [NewFeatureModel model:[UIImage imageNamed:@"f3"]];

window.rootViewController = [CoreNewFeatureVC newFeatureVCWithModels:@[m1,m2,m3]];

[window makeKeyAndVisible];

return YES;
}

Expand Down
25 changes: 25 additions & 0 deletions CoreNewFeatureVC/CoreNewFeatureVC/CoreNewFeatureVC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// CoreNewFeatureVC.h
// CoreNewFeatureVC
//
// Created by 冯成林 on 15/4/27.
// Copyright (c) 2015年 冯成林. All rights reserved.
//

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


@interface CoreNewFeatureVC : UIViewController

@property (nonatomic,strong) NSArray *images;



/*
* 初始化
*/
+(instancetype)newFeatureVCWithModels:(NSArray *)models;


@end
121 changes: 121 additions & 0 deletions CoreNewFeatureVC/CoreNewFeatureVC/CoreNewFeatureVC.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
//
// CoreNewFeatureVC.m
// CoreNewFeatureVC
//
// Created by 冯成林 on 15/4/27.
// Copyright (c) 2015年 冯成林. All rights reserved.
//

#import "CoreNewFeatureVC.h"
#import "UIView+Masony.h"
#import "NewFeatureScrollView.h"
#import "NewFeatureImageV.h"


@interface CoreNewFeatureVC ()


/** 模型数组 */
@property (nonatomic,strong) NSArray *models;

/** scrollView */
@property (nonatomic,weak) NewFeatureScrollView *scrollView;


@end

@implementation CoreNewFeatureVC

/*
* 初始化
*/
+(instancetype)newFeatureVCWithModels:(NSArray *)models{

CoreNewFeatureVC *newFeatureVC = [[CoreNewFeatureVC alloc] init];

newFeatureVC.models = models;

return newFeatureVC;
}


-(void)viewDidLoad{

[super viewDidLoad];

//控制器准备
[self vcPrepare];
}


/*
* 控制器准备
*/
-(void)vcPrepare{

//添加scrollView
NewFeatureScrollView *scrollView = [[NewFeatureScrollView alloc] init];

_scrollView = scrollView;

//添加
[self.view addSubview:scrollView];

//添加约束
[scrollView masViewAddConstraintMakeEqualSuperViewWithInsets:UIEdgeInsetsZero];

//添加图片
[self imageViewsPrepare];
}




/*
* 添加图片
*/
-(void)imageViewsPrepare{

[self.models enumerateObjectsUsingBlock:^(NewFeatureModel *model, NSUInteger idx, BOOL *stop) {

NewFeatureImageV *imageV = [[NewFeatureImageV alloc] init];

//设置图片
imageV.image = model.image;

//记录tag
imageV.tag = idx;

if(idx == self.models.count -1) {

//开启交互
imageV.userInteractionEnabled = YES;

//添加手势
[imageV addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gestureAction:)]];
}

[_scrollView addSubview:imageV];
}];
}



-(void)gestureAction:(UITapGestureRecognizer *)tap{

UIView *tapView = tap.view;

//禁用
tapView.userInteractionEnabled = NO;

if(UIGestureRecognizerStateEnded == tap.state) [self dismiss];


}

-(void)dismiss{
NSLog(@"消失");
}


@end
22 changes: 22 additions & 0 deletions CoreNewFeatureVC/CoreNewFeatureVC/Model/NewFeatureModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// NewFeatureModel.h
// CoreNewFeatureVC
//
// Created by 冯成林 on 15/4/27.
// Copyright (c) 2015年 冯成林. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface NewFeatureModel : NSObject

@property (nonatomic,strong) UIImage *image;


/*
* 初始化
*/
+(instancetype)model:(UIImage *)image;

@end
26 changes: 26 additions & 0 deletions CoreNewFeatureVC/CoreNewFeatureVC/Model/NewFeatureModel.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// NewFeatureModel.m
// CoreNewFeatureVC
//
// Created by 冯成林 on 15/4/27.
// Copyright (c) 2015年 冯成林. All rights reserved.
//

#import "NewFeatureModel.h"

@implementation NewFeatureModel

/*
* 初始化
*/
+(instancetype)model:(UIImage *)image{

NewFeatureModel *model = [[NewFeatureModel alloc] init];

model.image = image;

return model;
}


@end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// ViewController.h
// NewFeatureImageV.h
// CoreNewFeatureVC
//
// Created by 冯成林 on 15/4/27.
Expand All @@ -8,8 +8,6 @@

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

@interface NewFeatureImageV : UIImageView

@end

Loading

0 comments on commit 18aedfe

Please sign in to comment.