1、利用delegate实现
View 1
// ViewController.h
#import <UIKit/UIKit.h>
#import "AnotherViewController.h"
@interface ViewController : UIViewController<SendMessageDelegate>
@end
// ViewController.m
#import "ViewController.h"
#import "AnotherViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
UIButton * btn = [[UIButton alloc] init];
[btn setFrame:CGRectMake(100.0, 100.0, 100.0, 30.0)];
[btn setBackgroundColor:[UIColor blackColor]];
[btn setTitle:@"View 1" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(showAnotherView) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
// Do any additional setup after