Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rahul29tech

macrumors member
Original poster
Dec 22, 2011
41
0
how to refresh table's cell when click on a button which is on another view,

actully my table view is on a viewcontroller class and a button is on its subclass? now i want as button clicked which is on its subclass ,so subclass closed and data on super class's table is refreshed , how to do this????????



i create a uiTableView object i.e

this function is in superView which contain a table view :-
Code:
-(void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    UITableView *tbv1=[[UITableView alloc] init];
    [tbv1 reloadData];    
}

this function is in my subView of above view i.e
Code:
-(IBAction) btn
{
   [self.view removeFromSuperview];
}


so when this subView is removed from superview so my viewWillAppear method is not calling not executing and table is not reloaded????? suggest me what to do now????
 
Last edited:

admanimal

macrumors 68040
Apr 22, 2005
3,531
2
The table view object you create and refer to in viewWillAppear is NOT the same table view that apparently appears in your app, which I'm guessing you added with interface builder.

You need to connect the actual table view in your xib file to an IBOutlet that you create in your view controller subclass, and then use this instance variable to manipulate the table view. Literally any UITableView tutorial on the web will show you how to do this.
 

rahul29tech

macrumors member
Original poster
Dec 22, 2011
41
0
yes sir u catch the exact problem,

soo plz suggest me how can i make reference of that same table, so that i can reload the same table :( ??? how can i get or make reference of that same table ????

m very new in iphone plz help me...m in this problem from last 48hrs
 

rahul29tech

macrumors member
Original poster
Dec 22, 2011
41
0
m creating an iboutlet uitableview object attached it from my tableview in IB ,and then i will trying to reload that object even though it is not reloading table and not calling cellForRowAtIndexPath method while when reloading???


now what to do i cant think , :mad: :(
 

rahul29tech

macrumors member
Original poster
Dec 22, 2011
41
0
Problem solved...

:):):) after 3 days i solved my problem thanks to all.....

actually my viewWillAppear is not calling when i call removwFromSuperView method........so i have to push that page to call viewWillAppear method.....

thanks every1 to help me
 

waterskier2007

macrumors 68000
Jun 19, 2007
1,871
228
Novi, MI
Sure it does.

To clarify, I would have thought that it did. Seems obvious. I must have been doing something wrong because I got it to work since then. At the time I had set breakpoints and was sure that it wasn't hitting CellForRowAtIndexPath. Everything is good now
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.