0

I am not certain whether I need an IBAction for a UITableView, but what I am trying to do is have some sort of control that I can hide it during page load, and then populate its cells with data that I get from a remote server, and then display that UITableView.

How can I do that? When I currenly try to press control and drag the UITableView to the ViewController, it gives me optons of: dataSource or delegate. I chose dataSource, but then was not sure what to do next.

I tried to do something like this in the .h

@interface MyBusinessesController : UIViewController    

- (IBAction)businessList:(id)sender;
@property (weak, nonatomic) IBOutlet UITableView  *businessListProperty;

@end

and this in the .m

#import "MyBusinessesController.h"

@interface MyBusinessesController ()

@end

@implementation MyBusinessesController

@synthesize businessListProperty;
...

but it seems I am way off. What is the right way to do what I am trying to do?

Thank you!

GeekedOut
  • 16,905
  • 37
  • 107
  • 185
  • Check [here](http://stackoverflow.com/questions/4103643/custom-uitableviewcell-and-ibaction) – Nathan Jul 29 '12 at 23:37
  • @Nathan just took a look...its good for manipulating the table cells which is what I need, but how do I hide/show the entire UITableView on the screen? I can't seem to connect the thing I made in the storyboard to something that would be recognized by the code. – GeekedOut Jul 29 '12 at 23:43
  • In Your header file `@property(nonatomic,retain)IBOutlet UITableView *businessListProperty;` Then connect it to your tableview via storyboard then in the `-(void)viewDidLoad` function call `self.businessListProperty.hidden=TRUE;` – Praxder Jul 29 '12 at 23:48

1 Answers1

2

If I understand your question correctly you want a UITableView to be hidden when the view loads and download some info from a server in the background then when all data is finished downloading display the table view? Why do you need an IBAction? In viewDidLoad set the "businessListProperty" table to hidden, self.businessListProperty.hidden=TRUE; then use an NSURLConnection to download the info from the server and in connectionDidFinishLoading set the table view to whatever data you downloaded and then set its hidden value to false.

-(void)connectionDidFinishLoading:(NSURLConnection *)connection{

//set tableview to whatever you downloaded here
self.businessListProperty.hidden=FALSE;

}

-Shrdder2794

Praxder
  • 2,315
  • 4
  • 32
  • 51
  • thank you - the only thing that I still do not really understand is how to connect the UITableView that I made to that property "businessListProperty" ...how do I actually make the system associate the UITableView with "businessListProperty" ? – GeekedOut Jul 29 '12 at 23:48
  • In your header file declare you IBOutlet var then in storyboard find the ViewController that is associated with the class you declared your IBOutlet in. If you havent done this already in storyboard click the root ViewController that has your tableView in it and click: Identity inspector>drop down menu for "class" and set the class to the one that has your table view in it. Then just go to "show connection inspector" and control-click your var to the tableView. – Praxder Jul 29 '12 at 23:55