I’m in a UITableView and the user has watched a video. After the video I would like the user to take a test. Just can’t figure out how to call this view controller so I can start the test.
Im in the PlayListViewController and want to call the TestViewController.
The TestViewController.h is imported. At this stage all there is in the TestViewController is what comes with UIViewController and some stuff that I added in .xib. The test coding isn’t done yet (that will be the next problem).
I would greatly appreciate if someone has the time to give me directions.
-(void) movieFinishedPlaying: (NSNotification *) note {
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:[player moviePlayer]];
[player release];
NSLog(@"Video has finished playing\n");
// To the test
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Info"
message:@"Now for the test!"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
[alert release];
// Call on test here
TestViewController *testVC = [[TestViewController alloc] init];
[self presentModalViewController:testVC animated:YES];
[testVC release];
}
I have this in the TestViewController.h
#import <UIKit/UIKit.h>
@interface TestViewController : UIViewController {
UIWindow *tVC;
UIViewController *testVC;
}
@property (nonatomic, retain) IBOutlet UIWindow *tVC;
@property (nonatomic, retain) IBOutlet UIViewController *testVC;
@end
And this in the m file
#import "TestViewController.h"
@implementation TestViewController
@synthesize testVC, tVC;
Register for MPMoviePlayerPlaybackDidFinishNotification notification before playing video (I guess you are using MPMoviePlayerController to play video, right?):
and when it get’s fired, present him the instance of TestViewController modally and unregister the notification: