0

I'm using ECSliding and I have this problem!

In my project there are this files:

FirstViewController(UIViewController) (topViewController)
LefViewController(UIViewController) (underLeftController)

I do this in my LeftViewController because I need to call a timer that is in FirstViewController:

FirstViewController *first = self.slidingViewController.topViewController;

and I get this warning:

Incompatible pointer types initializing 'FirstViewController *_strong' with an expression of type 'UIViewController *'

everything works fine but if it possibile I would like to get rid of it. Any idea?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Tortuga
  • 97
  • 3
  • 10

1 Answers1

1

You're looking for a cast:

FirstViewController *first = (FirstViewController *)self.slidingViewController.topViewController;

This tells the compiler "trust me, it's a FirstViewController instance". If it isn't when you come to run the code you'll get an exception.

Wain
  • 118,658
  • 15
  • 128
  • 151