ios - Compare UIVIewController with Class -


i use below code active viewcontroller

appdelegate *appdelegate = (appdelegate*)[[uiapplication sharedapplication] delegate];     uiviewcontroller *controller = appdelegate.window.rootviewcontroller; 

i want find viewcontroller (controller) of class,for use below code doesn't work

my classes: first.m , first.h , first.xib second.m , second.h , second.xib third.m , third.h , third.xib  if([controller iskindofclass:[first class]]) .... 

if app's root view controller uinavigationcontroller can this:

uiviewcontroller *controller = ((uinavigationcontroller*)appdelegate.window.rootviewcontroller).visibleviewcontroller; 

similarly, if it's uitabbarcontroller can this:

uiviewcontroller *controller = ((uitabbarcontroller*)appdelegate.window.rootviewcontroller).selectedviewcontroller; 

finally,

if ([controller iskindofclass:[first class]]) {  } 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -