Krunal
Krunal

Reputation: 6490

Hide TableView declared in other class

How to hide my tableView which is declared in another class..

Here is my code snippet,

CRStoreView.h

@interface CRStoreView : UIView <UITableViewDelegate, UITableViewDataSource>{
            ....
  }

@property (strong, nonatomic) IBOutlet UITableView *tblStore;

and i want to hide this tblStore in my new class(CRNextView.m)..

I tried this but table is not getting hide,

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

    NSLog(@"touchesBegan");
    CRStoreView *Obj = [[CRStoreView alloc] init];
    [Obj.tblStore setHidden:YES];
}

How to Solve it ?

Upvotes: 0

Views: 82

Answers (1)

codingNinja
codingNinja

Reputation: 371

One method is to use delegates. Make CRStoreView a delegate of the CRNextView and call the setHidden method from the CRNextView on the delegate. Or you could pass the current instance of the CRStoreView to CRNextView and access the tableView object.

Upvotes: 1

Related Questions