我正在使用 Xcode 4.6.1 为 iOS 6 开发。
我有两个视图控制器:viewController1
和viewController2
. 我正在尝试访问以下定义的属性viewController1
(viewController2
但它不起作用):
这是viewController1.m
:
#import "viewController1.h"
@interface viewController1 ()
@property (nonatomic) MPMoviePlayerController *videoPlayer;
@end
@implementation viewController1
...
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
...
self.videoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
...
[self.videoPlayer play];
...
}
这是viewController2.m
:
#import "viewController2.h"
#import "viewController1.h"
@interface viewController2 ()
@end
@implementation viewController2
...
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
viewController1 *thePlayer;
[thePlayer.videoPlayer pause];
//This is where I get an error:
//Property 'videoPlayer' not found on object of type 'viewController1 *'
}
我已经尝试了很多搜索,但我无法弄清楚我做错了什么。任何帮助将不胜感激。
谢谢!:)