Skip to content

Commit

Permalink
添加block回调
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlinFeng committed Apr 27, 2015
1 parent 420359e commit 4ed0cd7
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?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>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>6275D3BA-72A1-4845-96A7-7A5BF2B72B27</string>
<key>IDESourceControlProjectName</key>
<string>CoreNewFeatureVC</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>ACED2D41D1663676B7F2736D85A52220429D5605</key>
<string>https://github.com/nsdictionary/CoreNewFeatureVC.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>CoreNewFeatureVC.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>ACED2D41D1663676B7F2736D85A52220429D5605</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/nsdictionary/CoreNewFeatureVC.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>ACED2D41D1663676B7F2736D85A52220429D5605</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>ACED2D41D1663676B7F2736D85A52220429D5605</string>
<key>IDESourceControlWCCName</key>
<string>CoreNewFeatureVC</string>
</dict>
</array>
</dict>
</plist>
11 changes: 9 additions & 2 deletions CoreNewFeatureVC/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,21 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

self.window = window;

if([CoreNewFeatureVC canShowNewFeature]){
BOOL canShow = [CoreNewFeatureVC canShowNewFeature];

canShow = YES;

if(canShow){

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.rootViewController = [CoreNewFeatureVC newFeatureVCWithModels:@[m1,m2,m3] enterBlock:^{
NSLog(@"结束回调");
}];
}else{
UIViewController *vc = [[UIViewController alloc] init];
vc.view.backgroundColor = [UIColor brownColor];
Expand Down
2 changes: 1 addition & 1 deletion CoreNewFeatureVC/CoreNewFeatureVC/CoreNewFeatureVC.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/*
* 初始化
*/
+(instancetype)newFeatureVCWithModels:(NSArray *)models;
+(instancetype)newFeatureVCWithModels:(NSArray *)models enterBlock:(void(^)())enterBlock;



Expand Down
9 changes: 7 additions & 2 deletions CoreNewFeatureVC/CoreNewFeatureVC/CoreNewFeatureVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ @interface CoreNewFeatureVC ()
/** scrollView */
@property (nonatomic,weak) NewFeatureScrollView *scrollView;

@property (nonatomic,copy) void(^enterBlock)();

@end

Expand All @@ -33,12 +34,15 @@ @implementation CoreNewFeatureVC
/*
* 初始化
*/
+(instancetype)newFeatureVCWithModels:(NSArray *)models{
+(instancetype)newFeatureVCWithModels:(NSArray *)models enterBlock:(void(^)())enterBlock{

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

newFeatureVC.models = models;

//记录block
newFeatureVC.enterBlock =enterBlock;

return newFeatureVC;
}

Expand Down Expand Up @@ -133,7 +137,8 @@ -(void)gestureAction:(UITapGestureRecognizer *)tap{
}

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

if(self.enterBlock != nil) _enterBlock();
}

/*
Expand Down

0 comments on commit 4ed0cd7

Please sign in to comment.