GeekedOut
GeekedOut

Reputation: 17185

ios - how to create an IBAction for a UITableView?

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!

Upvotes: 0

Views: 389

Answers (1)

Praxder
Praxder

Reputation: 2759

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

Upvotes: 2

Related Questions