也许您应该尝试在第一个 (A) 视图控制器上设置一个属性并将其传递给您的第二个 (B) 视图控制器。
FirstViewController.h:
#import <UIKit/UIKit.h>
@interface FirstViewController : UIViewController
@property (nonatomic, strong) NSData *data;
@end
FirstViewController.m:
#import "FirstViewController.h"
@interface FirstViewController()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (IBAction)generateAudioData
{
self.data = // Your audio data generating code goes here perhaps?
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
@end
SecondViewController.h:
#import <UIKit/UIKit.h>
@interface SecondViewController : UIViewController
@end
SecondViewController.m:
#import "FirstViewController.h"
#import "SecondViewController.h"
@interface SecondViewController()
@property (nonatomic, strong) NSData *graphData;
@end
@implementation SecondViewController
- (void)viewDidLoad
{
[super viewDidLoad];
FirstViewController *audioData = (FirstViewController *)[[UIApplication sharedApplication] delegate];
self.graphData = audioData.data;
// Create your graph UIView here and populate it with self.graphData
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
@end