0
votes

I am following the tutorial at HeadsUpUI

I just want to add extra function such as if I click on play or pause button from the hover, I will move to another view controller called NextViewController.

What I did is

1.- (IBAction)rightAction:(id)sender{

  1. // user touched the right button in HoverView
  2. [self showHoverView:NO];
  3. NextViewController *controller = [[NextViewController alloc] initWithNibName:@"NextViewController" bundle:nil];
  4. [self.navigationController pushViewController:controller animated:YES]; }

After clicking on either pause or play button, nothing happens at all. However, if i replace line 5 by

[self presentModalViewController:controller animated:YES];

and it works.

Can somebody advice me if you know what the problem is. Any comments are welcomed here.

2

2 Answers

5
votes

There is no navigation controller, so you cannot ask it to push a new view controller. Any view controller can present a modal view controller, which is why your second example works.

0
votes

I had a similar problem. Make sure your class is a subclass of UIViewController. Your .h file should read :

.
.
.
@interface ClassName : UIViewController
.
.
.