Friday, May 6, 2011

How do I check what current view is?

I want to check what the current view is objective c (in cocoa touch)

Could I do something like this?

if (viewA == current view) {

run code here

}

Thanks

From stackoverflow
  • if you are in a Controller just do the following

    currentView = self.view;
    
  • See this SO question.

  • UIView *view1;
    UIView *view2;
    UIView *view3;
    
    
    self.view = view1;
    
    
    
    if (self.view==view1){
    
    //do something
    
    }
    

0 comments:

Post a Comment