├── TestCallBack ├── en.lproj │ └── InfoPlist.strings ├── AppDelegate.h ├── RootViewController.h ├── DataSource.h ├── BlockObject.h ├── BlockObject.m ├── main.m ├── TestCallBack-Prefix.pch ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── DataSource.m ├── SecondViewController.h ├── TestCallBack-Info.plist ├── AppDelegate.m ├── SecondViewController.m ├── RootViewController.m ├── RootViewController.xib └── SecondViewController.xib ├── TestCallBackTests ├── en.lproj │ └── InfoPlist.strings ├── TestCallBackTests-Info.plist └── TestCallBackTests.m ├── README.md └── TestCallBack.xcodeproj ├── project.xcworkspace ├── contents.xcworkspacedata ├── xcuserdata │ └── csdc-imac.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcshareddata │ └── TestCallBack.xccheckout ├── xcuserdata └── csdc-imac.xcuserdatad │ ├── xcschemes │ ├── xcschememanagement.plist │ └── TestCallBack.xcscheme │ └── xcdebugger │ └── Breakpoints_v2.xcbkptlist └── project.pbxproj /TestCallBack/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /TestCallBackTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PassValue 2 | ========= 3 | 4 | 实现了以下iOS页面间传值:1.委托delegate方式;2.通知notification方式;3.block方式;4.UserDefault或者文件方式;5.单例模式方式;6.通过设置属性,实现页面间传值 5 | -------------------------------------------------------------------------------- /TestCallBack.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TestCallBack.xcodeproj/project.xcworkspace/xcuserdata/csdc-imac.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangtao169447/PassValue/HEAD/TestCallBack.xcodeproj/project.xcworkspace/xcuserdata/csdc-imac.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /TestCallBack/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // TestCallBack 4 | // 5 | // Created by csdc-iMac on 14-7-17. 6 | // Copyright (c) 2014年 JuneWang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /TestCallBack/RootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.h 3 | // TestCallBack 4 | // 5 | // Created by csdc-iMac on 14-7-17. 6 | // Copyright (c) 2014年 JuneWang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SecondViewController.h" 11 | @interface RootViewController : UIViewController 12 | 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /TestCallBack/DataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // DataSource.h 3 | // TestCallBack 4 | // 5 | // Created by csdc-iMac on 14-7-17. 6 | // Copyright (c) 2014年 JuneWang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DataSource : NSObject 12 | @property (nonatomic, strong) NSString *myName; 13 | +(DataSource*)sharedDataSource; 14 | @end 15 | -------------------------------------------------------------------------------- /TestCallBack/BlockObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // blockObject.h 3 | // TestCallBack 4 | // 5 | // Created by csdc-iMac on 14-7-17. 6 | // Copyright (c) 2014年 JuneWang. All rights reserved. 7 | // 8 | 9 | #import 10 | typedef void (^changeColor)(UIColor *newColor); 11 | @interface BlockObject : NSObject 12 | +(void)changeButtonColor:(changeColor)changeColor; 13 | @end 14 | -------------------------------------------------------------------------------- /TestCallBack/BlockObject.m: -------------------------------------------------------------------------------- 1 | // 2 | // blockObject.m 3 | // TestCallBack 4 | // 5 | // Created by csdc-iMac on 14-7-17. 6 | // Copyright (c) 2014年 JuneWang. All rights reserved. 7 | // 8 | 9 | #import "BlockObject.h" 10 | 11 | @implementation BlockObject 12 | +(void)changeButtonColor:(changeColor)changeColor{ 13 | changeColor([UIColor orangeColor]); 14 | NSLog(@"heihei"); 15 | } 16 | @end 17 | -------------------------------------------------------------------------------- /TestCallBack/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TestCallBack 4 | // 5 | // Created by csdc-iMac on 14-7-17. 6 | // Copyright (c) 2014年 JuneWang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TestCallBack/TestCallBack-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /TestCallBack/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /TestCallBack/DataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // DataSource.m 3 | // TestCallBack 4 | // 5 | // Created by csdc-iMac on 14-7-17. 6 | // Copyright (c) 2014年 JuneWang. All rights reserved. 7 | // 8 | 9 | #import "DataSource.h" 10 | 11 | @implementation DataSource 12 | +(DataSource *)sharedDataSource{ 13 | static DataSource *dataSource = nil; 14 | static dispatch_once_t once; 15 | dispatch_once(&once, ^{ 16 | dataSource = [DataSource new]; 17 | }); 18 | return dataSource; 19 | } 20 | @end 21 | -------------------------------------------------------------------------------- /TestCallBack/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /TestCallBack/SecondViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.h 3 | // TestCallBack 4 | // 5 | // Created by csdc-iMac on 14-7-17. 6 | // Copyright (c) 2014年 JuneWang. All rights reserved. 7 | // 8 | 9 | #import 10 | typedef void (^ablock)(NSString *str); 11 | @protocol secondViewDelegate 12 | -(void)showName:(NSString *)nameString; 13 | @end 14 | @interface SecondViewController : UIViewController 15 | @property (nonatomic, weak)id delegate; 16 | @property (nonatomic, copy) ablock block; 17 | @property(nonatomic) NSInteger flag;//当前系统标示(0:其他传值方式;1:block传值方式) 18 | @end 19 | -------------------------------------------------------------------------------- /TestCallBack.xcodeproj/xcuserdata/csdc-imac.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | TestCallBack.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | ADD2DAC019775A5F00DC9E78 16 | 17 | primary 18 | 19 | 20 | ADD2DADB19775A5F00DC9E78 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /TestCallBackTests/TestCallBackTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | JuneWang.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /TestCallBackTests/TestCallBackTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestCallBackTests.m 3 | // TestCallBackTests 4 | // 5 | // Created by csdc-iMac on 14-7-17. 6 | // Copyright (c) 2014年 JuneWang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestCallBackTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation TestCallBackTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /TestCallBack.xcodeproj/xcuserdata/csdc-imac.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /TestCallBack/TestCallBack-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | JuneWang.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /TestCallBack.xcodeproj/project.xcworkspace/xcshareddata/TestCallBack.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | D88CB5D1-22DA-4F54-A4DA-5A976B052FCD 9 | IDESourceControlProjectName 10 | TestCallBack 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 6C540814-CD7E-4590-95B3-823F689427C8 14 | ssh://github.com/wangtao169447/PassValue.git 15 | 16 | IDESourceControlProjectPath 17 | TestCallBack.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 6C540814-CD7E-4590-95B3-823F689427C8 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://github.com/wangtao169447/PassValue.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | 6C540814-CD7E-4590-95B3-823F689427C8 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 6C540814-CD7E-4590-95B3-823F689427C8 36 | IDESourceControlWCCName 37 | PassValue 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /TestCallBack/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // TestCallBack 4 | // 5 | // Created by csdc-iMac on 14-7-17. 6 | // Copyright (c) 2014年 JuneWang. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "RootViewController.h" 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 16 | // Override point for customization after application launch. 17 | RootViewController *root = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil]; 18 | self.window.rootViewController = root; 19 | self.window.backgroundColor = [UIColor whiteColor]; 20 | [[UIApplication sharedApplication] setStatusBarHidden:YES]; 21 | [self.window makeKeyAndVisible]; 22 | return YES; 23 | } 24 | 25 | - (void)applicationWillResignActive:(UIApplication *)application 26 | { 27 | // 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. 28 | // 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. 29 | } 30 | 31 | - (void)applicationDidEnterBackground:(UIApplication *)application 32 | { 33 | // 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. 34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 35 | } 36 | 37 | - (void)applicationWillEnterForeground:(UIApplication *)application 38 | { 39 | // 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. 40 | } 41 | 42 | - (void)applicationDidBecomeActive:(UIApplication *)application 43 | { 44 | // 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. 45 | } 46 | 47 | - (void)applicationWillTerminate:(UIApplication *)application 48 | { 49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /TestCallBack.xcodeproj/xcuserdata/csdc-imac.xcuserdatad/xcschemes/TestCallBack.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /TestCallBack/SecondViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.m 3 | // TestCallBack 4 | // 5 | // Created by csdc-iMac on 14-7-17. 6 | // Copyright (c) 2014年 JuneWang. All rights reserved. 7 | // 8 | 9 | #import "SecondViewController.h" 10 | #import "DataSource.h" 11 | @interface SecondViewController () 12 | @property (weak, nonatomic) IBOutlet UITextField *nameTextField; 13 | @property (weak, nonatomic) IBOutlet UIButton *delegateMethod; 14 | @property (weak, nonatomic) IBOutlet UIButton *notificationMethod; 15 | @property (weak, nonatomic) IBOutlet UIButton *blockMethod; 16 | @property (weak, nonatomic) IBOutlet UIButton *userDefaultMethod; 17 | @property (weak, nonatomic) IBOutlet UIButton *singletonMethod; 18 | 19 | @end 20 | 21 | @implementation SecondViewController 22 | 23 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 24 | { 25 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 26 | if (self) { 27 | // Custom initialization 28 | } 29 | return self; 30 | } 31 | 32 | - (void)viewDidLoad 33 | { 34 | [super viewDidLoad]; 35 | // Do any additional setup after loading the view from its nib. 36 | } 37 | 38 | - (void)didReceiveMemoryWarning 39 | { 40 | [super didReceiveMemoryWarning]; 41 | // Dispose of any resources that can be recreated. 42 | } 43 | - (IBAction)Cancel:(id)sender { 44 | [self dismissViewControllerAnimated:YES completion:nil]; 45 | } 46 | 47 | - (IBAction)delegateMethod:(id)sender { 48 | if ([self notEmpty]) { 49 | [self.delegate showName:self.nameTextField.text]; 50 | [self dismissViewControllerAnimated:YES completion:nil]; 51 | }else{ 52 | [self showAlert]; 53 | } 54 | } 55 | 56 | -(IBAction)backDown:(id)sender{ 57 | [self.nameTextField resignFirstResponder]; 58 | } 59 | 60 | - (IBAction)notificationMethod:(id)sender { 61 | if ([self notEmpty]) { 62 | [[NSNotificationCenter defaultCenter] postNotificationName:@"ChangeNameNotification" object:self userInfo:@{@"name":self.nameTextField.text}]; 63 | [self dismissViewControllerAnimated:YES completion:nil]; 64 | }else{ 65 | [self showAlert]; 66 | } 67 | } 68 | - (IBAction)blockMethod:(id)sender { 69 | if ([self notEmpty]) { 70 | if (self.block) { 71 | self.block(self.nameTextField.text); 72 | [self dismissViewControllerAnimated:YES completion:nil]; 73 | } 74 | }else{ 75 | [self showAlert]; 76 | } 77 | } 78 | 79 | -(BOOL)notEmpty{ 80 | if ([self.nameTextField.text length] == 0) { 81 | return NO; 82 | } 83 | return YES; 84 | } 85 | 86 | -(void)showAlert{ 87 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请输入名字" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil]; 88 | [alert show]; 89 | } 90 | //通过文件或者UserDefault方式存值(感觉不太适合此类传值,如果要用文件或者UserDefault方式存值的话,可以考虑此方式) 91 | - (IBAction)userDefaultMethod:(id)sender { 92 | if ([self notEmpty]) { 93 | [[NSUserDefaults standardUserDefaults] setObject:self.nameTextField.text forKey:@"myNameText"]; 94 | [self dismissViewControllerAnimated:YES completion:nil]; 95 | }else{ 96 | [self showAlert]; 97 | } 98 | } 99 | 100 | //通过单例方式传值(感觉不太适合此类传值,如果要用单例方式传值的话,可以考虑此方式) 101 | - (IBAction)singletonMethod:(id)sender { 102 | if ([self notEmpty]) { 103 | DataSource *dataSource = [DataSource sharedDataSource]; 104 | dataSource.myName = self.nameTextField.text; 105 | [self dismissViewControllerAnimated:YES completion:nil]; 106 | }else{ 107 | [self showAlert]; 108 | } 109 | } 110 | -(void)viewWillAppear:(BOOL)animated{ 111 | [super viewWillAppear:animated]; 112 | if (self.flag == 0) { 113 | self.delegateMethod.hidden = NO; 114 | self.notificationMethod.hidden = NO; 115 | self.blockMethod.hidden = YES; 116 | self.userDefaultMethod.hidden = NO; 117 | self.singletonMethod.hidden = NO; 118 | }else{ 119 | self.delegateMethod.hidden = YES; 120 | self.notificationMethod.hidden = YES; 121 | self.blockMethod.hidden = NO; 122 | self.userDefaultMethod.hidden = YES; 123 | self.singletonMethod.hidden = YES; 124 | } 125 | } 126 | @end 127 | -------------------------------------------------------------------------------- /TestCallBack/RootViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.m 3 | // TestCallBack 4 | // 5 | // Created by csdc-iMac on 14-7-17. 6 | // Copyright (c) 2014年 JuneWang. All rights reserved. 7 | // 8 | 9 | #import "RootViewController.h" 10 | #import "SecondViewController.h" 11 | #import "BlockObject.h" 12 | #import "DataSource.h" 13 | @interface RootViewController () 14 | @property (weak, nonatomic) IBOutlet UILabel *nameLabel; 15 | 16 | @end 17 | 18 | @implementation RootViewController 19 | 20 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 21 | { 22 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 23 | if (self) { 24 | // Custom initialization 25 | } 26 | return self; 27 | } 28 | 29 | - (void)viewDidLoad 30 | { 31 | [super viewDidLoad]; 32 | // Do any additional setup after loading the view from its nib. 33 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ChangeNameNotification:) name:@"ChangeNameNotification" object:nil]; 34 | } 35 | 36 | - (void)didReceiveMemoryWarning 37 | { 38 | [super didReceiveMemoryWarning]; 39 | // Dispose of any resources that can be recreated. 40 | } 41 | 42 | - (IBAction)showSecondView:(id)sender { 43 | SecondViewController *second = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; 44 | second.delegate = self; 45 | second.flag = 0; 46 | [self presentViewController:second animated:YES completion:nil]; 47 | } 48 | 49 | -(void)showName:(NSString *)nameString{ 50 | self.nameLabel.text = nameString; 51 | } 52 | -(void)ChangeNameNotification:(NSNotification*)notification{ 53 | NSDictionary *nameDictionary = [notification userInfo]; 54 | self.nameLabel.text = [nameDictionary objectForKey:@"name"]; 55 | } 56 | 57 | - (IBAction)showSecondWithBlock:(id)sender { 58 | SecondViewController *second = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; 59 | second.flag = 1; 60 | [self presentViewController:second animated:YES completion:nil]; 61 | second.block = ^(NSString *str){ 62 | self.nameLabel.text = str; 63 | }; 64 | } 65 | - (IBAction)changeButtonColor:(id)sender { 66 | [BlockObject changeButtonColor:^(UIColor*newColor){ 67 | UIButton *button = sender; 68 | button.backgroundColor = newColor; 69 | }]; 70 | 71 | //以下为一些简单的block测试,想看效果的话,取消注释即可 72 | /* 73 | int (^myblock_1)(int a, int b) = ^(int a, int b){ 74 | return a + b; 75 | }; 76 | NSLog(@"------%d", myblock_1(1, 2)); 77 | 78 | //__block 变量 79 | __block int num; 80 | int (^myblock_2)(int a, int b) = ^(int a, int b){ 81 | num = a + b; 82 | return num; 83 | }; 84 | NSLog(@"++++++%d", myblock_2(2, 3)); 85 | 86 | //Block传递函数指针 87 | int (^test_1)()= ^{ 88 | NSLog(@"I"); 89 | return 1; 90 | }; 91 | int (^test_2)()= ^{ 92 | NSLog(@"MANNA"); 93 | return 2; 94 | }; 95 | int (^test_3)()= ^{ 96 | NSLog(@"PLAY"); 97 | return 3; 98 | }; 99 | [self testBlock:test_1]; 100 | [self testBlock:test_2]; 101 | [self testBlock:test_3]; 102 | 103 | //多Block参数 104 | [self testBlock_Concurrency:^{ 105 | NSLog(@"这是第一个Block."); 106 | return 100; 107 | }block_2:^(int p){ 108 | NSLog(@"这是第二个Block."); 109 | }block_3:^{ 110 | NSLog(@"这是第三个Block."); 111 | }]; 112 | */ 113 | } 114 | 115 | - (void)testBlock:(int (^)())test_block 116 | { 117 | int result = test_block(); 118 | NSLog(@"注意先后顺序,结果是:%d", result); 119 | } 120 | 121 | - (void)testBlock_Concurrency:(int (^)())block_1 block_2:(void(^)(int))block_2 block_3:(void(^)())block_3 122 | { 123 | int result = block_1(); 124 | block_2(100); 125 | block_3(); 126 | 127 | NSLog(@"多么神奇的Block.result=%d.", result); 128 | } 129 | 130 | -(void)dealloc{ 131 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 132 | } 133 | -(void)viewDidAppear:(BOOL)animated{ 134 | [super viewDidAppear:animated]; 135 | //如果想测试通过UserDefault方式传值或者通过单例方式传值,取消以下注释即可 136 | /* 137 | if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"myNameText"] length] != 0) { 138 | self.nameLabel.text = [[NSUserDefaults standardUserDefaults] objectForKey:@"myNameText"]; 139 | [[NSUserDefaults standardUserDefaults] setObject:@"" forKey:@"myNameText"]; 140 | } 141 | DataSource *dataSource = [DataSource sharedDataSource]; 142 | if ([dataSource.myName length] != 0) { 143 | self.nameLabel.text = dataSource.myName; 144 | dataSource.myName = @""; 145 | } 146 | */ 147 | } 148 | @end 149 | -------------------------------------------------------------------------------- /TestCallBack/RootViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 28 | 35 | 45 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /TestCallBack/SecondViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 39 | 49 | 59 | 69 | 79 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /TestCallBack.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | ADD2DAC519775A5F00DC9E78 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD2DAC419775A5F00DC9E78 /* Foundation.framework */; }; 11 | ADD2DAC719775A5F00DC9E78 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD2DAC619775A5F00DC9E78 /* CoreGraphics.framework */; }; 12 | ADD2DAC919775A5F00DC9E78 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD2DAC819775A5F00DC9E78 /* UIKit.framework */; }; 13 | ADD2DACF19775A5F00DC9E78 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = ADD2DACD19775A5F00DC9E78 /* InfoPlist.strings */; }; 14 | ADD2DAD119775A5F00DC9E78 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD2DAD019775A5F00DC9E78 /* main.m */; }; 15 | ADD2DAD519775A5F00DC9E78 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD2DAD419775A5F00DC9E78 /* AppDelegate.m */; }; 16 | ADD2DAD719775A5F00DC9E78 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ADD2DAD619775A5F00DC9E78 /* Images.xcassets */; }; 17 | ADD2DADE19775A5F00DC9E78 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD2DADD19775A5F00DC9E78 /* XCTest.framework */; }; 18 | ADD2DADF19775A6000DC9E78 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD2DAC419775A5F00DC9E78 /* Foundation.framework */; }; 19 | ADD2DAE019775A6000DC9E78 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD2DAC819775A5F00DC9E78 /* UIKit.framework */; }; 20 | ADD2DAE819775A6000DC9E78 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = ADD2DAE619775A6000DC9E78 /* InfoPlist.strings */; }; 21 | ADD2DAEA19775A6000DC9E78 /* TestCallBackTests.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD2DAE919775A6000DC9E78 /* TestCallBackTests.m */; }; 22 | ADD2DAF619775A7500DC9E78 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD2DAF419775A7500DC9E78 /* RootViewController.m */; }; 23 | ADD2DAF719775A7500DC9E78 /* RootViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADD2DAF519775A7500DC9E78 /* RootViewController.xib */; }; 24 | ADD2DAFB19775A8000DC9E78 /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD2DAF919775A8000DC9E78 /* SecondViewController.m */; }; 25 | ADD2DAFC19775A8000DC9E78 /* SecondViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADD2DAFA19775A8000DC9E78 /* SecondViewController.xib */; }; 26 | ADD2DAFF19777B1300DC9E78 /* BlockObject.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD2DAFE19777B1300DC9E78 /* BlockObject.m */; }; 27 | ADD2DB0219779BB400DC9E78 /* DataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD2DB0119779BB400DC9E78 /* DataSource.m */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXContainerItemProxy section */ 31 | ADD2DAE119775A6000DC9E78 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = ADD2DAB919775A5F00DC9E78 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = ADD2DAC019775A5F00DC9E78; 36 | remoteInfo = TestCallBack; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | ADD2DAC119775A5F00DC9E78 /* TestCallBack.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestCallBack.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | ADD2DAC419775A5F00DC9E78 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 43 | ADD2DAC619775A5F00DC9E78 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 44 | ADD2DAC819775A5F00DC9E78 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 45 | ADD2DACC19775A5F00DC9E78 /* TestCallBack-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TestCallBack-Info.plist"; sourceTree = ""; }; 46 | ADD2DACE19775A5F00DC9E78 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 47 | ADD2DAD019775A5F00DC9E78 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 48 | ADD2DAD219775A5F00DC9E78 /* TestCallBack-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TestCallBack-Prefix.pch"; sourceTree = ""; }; 49 | ADD2DAD319775A5F00DC9E78 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 50 | ADD2DAD419775A5F00DC9E78 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 51 | ADD2DAD619775A5F00DC9E78 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 52 | ADD2DADC19775A5F00DC9E78 /* TestCallBackTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestCallBackTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | ADD2DADD19775A5F00DC9E78 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 54 | ADD2DAE519775A6000DC9E78 /* TestCallBackTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TestCallBackTests-Info.plist"; sourceTree = ""; }; 55 | ADD2DAE719775A6000DC9E78 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 56 | ADD2DAE919775A6000DC9E78 /* TestCallBackTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestCallBackTests.m; sourceTree = ""; }; 57 | ADD2DAF319775A7500DC9E78 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 58 | ADD2DAF419775A7500DC9E78 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; 59 | ADD2DAF519775A7500DC9E78 /* RootViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RootViewController.xib; sourceTree = ""; }; 60 | ADD2DAF819775A8000DC9E78 /* SecondViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = ""; }; 61 | ADD2DAF919775A8000DC9E78 /* SecondViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = ""; }; 62 | ADD2DAFA19775A8000DC9E78 /* SecondViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SecondViewController.xib; sourceTree = ""; }; 63 | ADD2DAFD19777B1300DC9E78 /* BlockObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlockObject.h; sourceTree = ""; }; 64 | ADD2DAFE19777B1300DC9E78 /* BlockObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlockObject.m; sourceTree = ""; }; 65 | ADD2DB0019779BB400DC9E78 /* DataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataSource.h; sourceTree = ""; }; 66 | ADD2DB0119779BB400DC9E78 /* DataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DataSource.m; sourceTree = ""; }; 67 | /* End PBXFileReference section */ 68 | 69 | /* Begin PBXFrameworksBuildPhase section */ 70 | ADD2DABE19775A5F00DC9E78 /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | ADD2DAC719775A5F00DC9E78 /* CoreGraphics.framework in Frameworks */, 75 | ADD2DAC919775A5F00DC9E78 /* UIKit.framework in Frameworks */, 76 | ADD2DAC519775A5F00DC9E78 /* Foundation.framework in Frameworks */, 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | ADD2DAD919775A5F00DC9E78 /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | ADD2DADE19775A5F00DC9E78 /* XCTest.framework in Frameworks */, 85 | ADD2DAE019775A6000DC9E78 /* UIKit.framework in Frameworks */, 86 | ADD2DADF19775A6000DC9E78 /* Foundation.framework in Frameworks */, 87 | ); 88 | runOnlyForDeploymentPostprocessing = 0; 89 | }; 90 | /* End PBXFrameworksBuildPhase section */ 91 | 92 | /* Begin PBXGroup section */ 93 | ADD2DAB819775A5F00DC9E78 = { 94 | isa = PBXGroup; 95 | children = ( 96 | ADD2DACA19775A5F00DC9E78 /* TestCallBack */, 97 | ADD2DAE319775A6000DC9E78 /* TestCallBackTests */, 98 | ADD2DAC319775A5F00DC9E78 /* Frameworks */, 99 | ADD2DAC219775A5F00DC9E78 /* Products */, 100 | ); 101 | sourceTree = ""; 102 | }; 103 | ADD2DAC219775A5F00DC9E78 /* Products */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | ADD2DAC119775A5F00DC9E78 /* TestCallBack.app */, 107 | ADD2DADC19775A5F00DC9E78 /* TestCallBackTests.xctest */, 108 | ); 109 | name = Products; 110 | sourceTree = ""; 111 | }; 112 | ADD2DAC319775A5F00DC9E78 /* Frameworks */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | ADD2DAC419775A5F00DC9E78 /* Foundation.framework */, 116 | ADD2DAC619775A5F00DC9E78 /* CoreGraphics.framework */, 117 | ADD2DAC819775A5F00DC9E78 /* UIKit.framework */, 118 | ADD2DADD19775A5F00DC9E78 /* XCTest.framework */, 119 | ); 120 | name = Frameworks; 121 | sourceTree = ""; 122 | }; 123 | ADD2DACA19775A5F00DC9E78 /* TestCallBack */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | ADD2DAD319775A5F00DC9E78 /* AppDelegate.h */, 127 | ADD2DAD419775A5F00DC9E78 /* AppDelegate.m */, 128 | ADD2DAD619775A5F00DC9E78 /* Images.xcassets */, 129 | ADD2DACB19775A5F00DC9E78 /* Supporting Files */, 130 | ADD2DAF319775A7500DC9E78 /* RootViewController.h */, 131 | ADD2DAF419775A7500DC9E78 /* RootViewController.m */, 132 | ADD2DAF519775A7500DC9E78 /* RootViewController.xib */, 133 | ADD2DAFD19777B1300DC9E78 /* BlockObject.h */, 134 | ADD2DAFE19777B1300DC9E78 /* BlockObject.m */, 135 | ADD2DAF819775A8000DC9E78 /* SecondViewController.h */, 136 | ADD2DAF919775A8000DC9E78 /* SecondViewController.m */, 137 | ADD2DAFA19775A8000DC9E78 /* SecondViewController.xib */, 138 | ADD2DB0019779BB400DC9E78 /* DataSource.h */, 139 | ADD2DB0119779BB400DC9E78 /* DataSource.m */, 140 | ); 141 | path = TestCallBack; 142 | sourceTree = ""; 143 | }; 144 | ADD2DACB19775A5F00DC9E78 /* Supporting Files */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | ADD2DACC19775A5F00DC9E78 /* TestCallBack-Info.plist */, 148 | ADD2DACD19775A5F00DC9E78 /* InfoPlist.strings */, 149 | ADD2DAD019775A5F00DC9E78 /* main.m */, 150 | ADD2DAD219775A5F00DC9E78 /* TestCallBack-Prefix.pch */, 151 | ); 152 | name = "Supporting Files"; 153 | sourceTree = ""; 154 | }; 155 | ADD2DAE319775A6000DC9E78 /* TestCallBackTests */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | ADD2DAE919775A6000DC9E78 /* TestCallBackTests.m */, 159 | ADD2DAE419775A6000DC9E78 /* Supporting Files */, 160 | ); 161 | path = TestCallBackTests; 162 | sourceTree = ""; 163 | }; 164 | ADD2DAE419775A6000DC9E78 /* Supporting Files */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | ADD2DAE519775A6000DC9E78 /* TestCallBackTests-Info.plist */, 168 | ADD2DAE619775A6000DC9E78 /* InfoPlist.strings */, 169 | ); 170 | name = "Supporting Files"; 171 | sourceTree = ""; 172 | }; 173 | /* End PBXGroup section */ 174 | 175 | /* Begin PBXNativeTarget section */ 176 | ADD2DAC019775A5F00DC9E78 /* TestCallBack */ = { 177 | isa = PBXNativeTarget; 178 | buildConfigurationList = ADD2DAED19775A6000DC9E78 /* Build configuration list for PBXNativeTarget "TestCallBack" */; 179 | buildPhases = ( 180 | ADD2DABD19775A5F00DC9E78 /* Sources */, 181 | ADD2DABE19775A5F00DC9E78 /* Frameworks */, 182 | ADD2DABF19775A5F00DC9E78 /* Resources */, 183 | ); 184 | buildRules = ( 185 | ); 186 | dependencies = ( 187 | ); 188 | name = TestCallBack; 189 | productName = TestCallBack; 190 | productReference = ADD2DAC119775A5F00DC9E78 /* TestCallBack.app */; 191 | productType = "com.apple.product-type.application"; 192 | }; 193 | ADD2DADB19775A5F00DC9E78 /* TestCallBackTests */ = { 194 | isa = PBXNativeTarget; 195 | buildConfigurationList = ADD2DAF019775A6000DC9E78 /* Build configuration list for PBXNativeTarget "TestCallBackTests" */; 196 | buildPhases = ( 197 | ADD2DAD819775A5F00DC9E78 /* Sources */, 198 | ADD2DAD919775A5F00DC9E78 /* Frameworks */, 199 | ADD2DADA19775A5F00DC9E78 /* Resources */, 200 | ); 201 | buildRules = ( 202 | ); 203 | dependencies = ( 204 | ADD2DAE219775A6000DC9E78 /* PBXTargetDependency */, 205 | ); 206 | name = TestCallBackTests; 207 | productName = TestCallBackTests; 208 | productReference = ADD2DADC19775A5F00DC9E78 /* TestCallBackTests.xctest */; 209 | productType = "com.apple.product-type.bundle.unit-test"; 210 | }; 211 | /* End PBXNativeTarget section */ 212 | 213 | /* Begin PBXProject section */ 214 | ADD2DAB919775A5F00DC9E78 /* Project object */ = { 215 | isa = PBXProject; 216 | attributes = { 217 | LastUpgradeCheck = 0510; 218 | ORGANIZATIONNAME = JuneWang; 219 | TargetAttributes = { 220 | ADD2DADB19775A5F00DC9E78 = { 221 | TestTargetID = ADD2DAC019775A5F00DC9E78; 222 | }; 223 | }; 224 | }; 225 | buildConfigurationList = ADD2DABC19775A5F00DC9E78 /* Build configuration list for PBXProject "TestCallBack" */; 226 | compatibilityVersion = "Xcode 3.2"; 227 | developmentRegion = English; 228 | hasScannedForEncodings = 0; 229 | knownRegions = ( 230 | en, 231 | ); 232 | mainGroup = ADD2DAB819775A5F00DC9E78; 233 | productRefGroup = ADD2DAC219775A5F00DC9E78 /* Products */; 234 | projectDirPath = ""; 235 | projectRoot = ""; 236 | targets = ( 237 | ADD2DAC019775A5F00DC9E78 /* TestCallBack */, 238 | ADD2DADB19775A5F00DC9E78 /* TestCallBackTests */, 239 | ); 240 | }; 241 | /* End PBXProject section */ 242 | 243 | /* Begin PBXResourcesBuildPhase section */ 244 | ADD2DABF19775A5F00DC9E78 /* Resources */ = { 245 | isa = PBXResourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | ADD2DAFC19775A8000DC9E78 /* SecondViewController.xib in Resources */, 249 | ADD2DACF19775A5F00DC9E78 /* InfoPlist.strings in Resources */, 250 | ADD2DAD719775A5F00DC9E78 /* Images.xcassets in Resources */, 251 | ADD2DAF719775A7500DC9E78 /* RootViewController.xib in Resources */, 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | ADD2DADA19775A5F00DC9E78 /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | ADD2DAE819775A6000DC9E78 /* InfoPlist.strings in Resources */, 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | /* End PBXResourcesBuildPhase section */ 264 | 265 | /* Begin PBXSourcesBuildPhase section */ 266 | ADD2DABD19775A5F00DC9E78 /* Sources */ = { 267 | isa = PBXSourcesBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | ADD2DAFB19775A8000DC9E78 /* SecondViewController.m in Sources */, 271 | ADD2DAD519775A5F00DC9E78 /* AppDelegate.m in Sources */, 272 | ADD2DB0219779BB400DC9E78 /* DataSource.m in Sources */, 273 | ADD2DAFF19777B1300DC9E78 /* BlockObject.m in Sources */, 274 | ADD2DAD119775A5F00DC9E78 /* main.m in Sources */, 275 | ADD2DAF619775A7500DC9E78 /* RootViewController.m in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | ADD2DAD819775A5F00DC9E78 /* Sources */ = { 280 | isa = PBXSourcesBuildPhase; 281 | buildActionMask = 2147483647; 282 | files = ( 283 | ADD2DAEA19775A6000DC9E78 /* TestCallBackTests.m in Sources */, 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | /* End PBXSourcesBuildPhase section */ 288 | 289 | /* Begin PBXTargetDependency section */ 290 | ADD2DAE219775A6000DC9E78 /* PBXTargetDependency */ = { 291 | isa = PBXTargetDependency; 292 | target = ADD2DAC019775A5F00DC9E78 /* TestCallBack */; 293 | targetProxy = ADD2DAE119775A6000DC9E78 /* PBXContainerItemProxy */; 294 | }; 295 | /* End PBXTargetDependency section */ 296 | 297 | /* Begin PBXVariantGroup section */ 298 | ADD2DACD19775A5F00DC9E78 /* InfoPlist.strings */ = { 299 | isa = PBXVariantGroup; 300 | children = ( 301 | ADD2DACE19775A5F00DC9E78 /* en */, 302 | ); 303 | name = InfoPlist.strings; 304 | sourceTree = ""; 305 | }; 306 | ADD2DAE619775A6000DC9E78 /* InfoPlist.strings */ = { 307 | isa = PBXVariantGroup; 308 | children = ( 309 | ADD2DAE719775A6000DC9E78 /* en */, 310 | ); 311 | name = InfoPlist.strings; 312 | sourceTree = ""; 313 | }; 314 | /* End PBXVariantGroup section */ 315 | 316 | /* Begin XCBuildConfiguration section */ 317 | ADD2DAEB19775A6000DC9E78 /* Debug */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ALWAYS_SEARCH_USER_PATHS = NO; 321 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 322 | CLANG_CXX_LIBRARY = "libc++"; 323 | CLANG_ENABLE_MODULES = YES; 324 | CLANG_ENABLE_OBJC_ARC = YES; 325 | CLANG_WARN_BOOL_CONVERSION = YES; 326 | CLANG_WARN_CONSTANT_CONVERSION = YES; 327 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 328 | CLANG_WARN_EMPTY_BODY = YES; 329 | CLANG_WARN_ENUM_CONVERSION = YES; 330 | CLANG_WARN_INT_CONVERSION = YES; 331 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 332 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 333 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 334 | COPY_PHASE_STRIP = NO; 335 | GCC_C_LANGUAGE_STANDARD = gnu99; 336 | GCC_DYNAMIC_NO_PIC = NO; 337 | GCC_OPTIMIZATION_LEVEL = 0; 338 | GCC_PREPROCESSOR_DEFINITIONS = ( 339 | "DEBUG=1", 340 | "$(inherited)", 341 | ); 342 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 350 | ONLY_ACTIVE_ARCH = YES; 351 | SDKROOT = iphoneos; 352 | }; 353 | name = Debug; 354 | }; 355 | ADD2DAEC19775A6000DC9E78 /* Release */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | ALWAYS_SEARCH_USER_PATHS = NO; 359 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 360 | CLANG_CXX_LIBRARY = "libc++"; 361 | CLANG_ENABLE_MODULES = YES; 362 | CLANG_ENABLE_OBJC_ARC = YES; 363 | CLANG_WARN_BOOL_CONVERSION = YES; 364 | CLANG_WARN_CONSTANT_CONVERSION = YES; 365 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 366 | CLANG_WARN_EMPTY_BODY = YES; 367 | CLANG_WARN_ENUM_CONVERSION = YES; 368 | CLANG_WARN_INT_CONVERSION = YES; 369 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 370 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 371 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 372 | COPY_PHASE_STRIP = YES; 373 | ENABLE_NS_ASSERTIONS = NO; 374 | GCC_C_LANGUAGE_STANDARD = gnu99; 375 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 376 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 377 | GCC_WARN_UNDECLARED_SELECTOR = YES; 378 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 379 | GCC_WARN_UNUSED_FUNCTION = YES; 380 | GCC_WARN_UNUSED_VARIABLE = YES; 381 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 382 | SDKROOT = iphoneos; 383 | VALIDATE_PRODUCT = YES; 384 | }; 385 | name = Release; 386 | }; 387 | ADD2DAEE19775A6000DC9E78 /* Debug */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 391 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 392 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 393 | GCC_PREFIX_HEADER = "TestCallBack/TestCallBack-Prefix.pch"; 394 | INFOPLIST_FILE = "TestCallBack/TestCallBack-Info.plist"; 395 | PRODUCT_NAME = "$(TARGET_NAME)"; 396 | WRAPPER_EXTENSION = app; 397 | }; 398 | name = Debug; 399 | }; 400 | ADD2DAEF19775A6000DC9E78 /* Release */ = { 401 | isa = XCBuildConfiguration; 402 | buildSettings = { 403 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 404 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 405 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 406 | GCC_PREFIX_HEADER = "TestCallBack/TestCallBack-Prefix.pch"; 407 | INFOPLIST_FILE = "TestCallBack/TestCallBack-Info.plist"; 408 | PRODUCT_NAME = "$(TARGET_NAME)"; 409 | WRAPPER_EXTENSION = app; 410 | }; 411 | name = Release; 412 | }; 413 | ADD2DAF119775A6000DC9E78 /* Debug */ = { 414 | isa = XCBuildConfiguration; 415 | buildSettings = { 416 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TestCallBack.app/TestCallBack"; 417 | FRAMEWORK_SEARCH_PATHS = ( 418 | "$(SDKROOT)/Developer/Library/Frameworks", 419 | "$(inherited)", 420 | "$(DEVELOPER_FRAMEWORKS_DIR)", 421 | ); 422 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 423 | GCC_PREFIX_HEADER = "TestCallBack/TestCallBack-Prefix.pch"; 424 | GCC_PREPROCESSOR_DEFINITIONS = ( 425 | "DEBUG=1", 426 | "$(inherited)", 427 | ); 428 | INFOPLIST_FILE = "TestCallBackTests/TestCallBackTests-Info.plist"; 429 | PRODUCT_NAME = "$(TARGET_NAME)"; 430 | TEST_HOST = "$(BUNDLE_LOADER)"; 431 | WRAPPER_EXTENSION = xctest; 432 | }; 433 | name = Debug; 434 | }; 435 | ADD2DAF219775A6000DC9E78 /* Release */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TestCallBack.app/TestCallBack"; 439 | FRAMEWORK_SEARCH_PATHS = ( 440 | "$(SDKROOT)/Developer/Library/Frameworks", 441 | "$(inherited)", 442 | "$(DEVELOPER_FRAMEWORKS_DIR)", 443 | ); 444 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 445 | GCC_PREFIX_HEADER = "TestCallBack/TestCallBack-Prefix.pch"; 446 | INFOPLIST_FILE = "TestCallBackTests/TestCallBackTests-Info.plist"; 447 | PRODUCT_NAME = "$(TARGET_NAME)"; 448 | TEST_HOST = "$(BUNDLE_LOADER)"; 449 | WRAPPER_EXTENSION = xctest; 450 | }; 451 | name = Release; 452 | }; 453 | /* End XCBuildConfiguration section */ 454 | 455 | /* Begin XCConfigurationList section */ 456 | ADD2DABC19775A5F00DC9E78 /* Build configuration list for PBXProject "TestCallBack" */ = { 457 | isa = XCConfigurationList; 458 | buildConfigurations = ( 459 | ADD2DAEB19775A6000DC9E78 /* Debug */, 460 | ADD2DAEC19775A6000DC9E78 /* Release */, 461 | ); 462 | defaultConfigurationIsVisible = 0; 463 | defaultConfigurationName = Release; 464 | }; 465 | ADD2DAED19775A6000DC9E78 /* Build configuration list for PBXNativeTarget "TestCallBack" */ = { 466 | isa = XCConfigurationList; 467 | buildConfigurations = ( 468 | ADD2DAEE19775A6000DC9E78 /* Debug */, 469 | ADD2DAEF19775A6000DC9E78 /* Release */, 470 | ); 471 | defaultConfigurationIsVisible = 0; 472 | defaultConfigurationName = Release; 473 | }; 474 | ADD2DAF019775A6000DC9E78 /* Build configuration list for PBXNativeTarget "TestCallBackTests" */ = { 475 | isa = XCConfigurationList; 476 | buildConfigurations = ( 477 | ADD2DAF119775A6000DC9E78 /* Debug */, 478 | ADD2DAF219775A6000DC9E78 /* Release */, 479 | ); 480 | defaultConfigurationIsVisible = 0; 481 | defaultConfigurationName = Release; 482 | }; 483 | /* End XCConfigurationList section */ 484 | }; 485 | rootObject = ADD2DAB919775A5F00DC9E78 /* Project object */; 486 | } 487 | --------------------------------------------------------------------------------