dataSource outlet

I'm wondering how to use outlet, dataSource on a UITableView class. I'm stuck because I can't view any data on the table. Does anyone know how? I've looked at other websites, but their tips don't work. I tried to add the dataSource to the UITableView class, using the interface builder application

Answers


The dataSource property of a UITableView is a delegate what you assign to the tableView... Then the tableView calls that assigned class when it comes to collecting data.. In order to get data to display on the tableView you need to implement the UITableViewDataSource delegate methods...

A good place to start would be checking out the UITableView Class Reference:

http://developer.apple.com/library/ios/documentation/uikit/reference/UITableView_Class/Reference/Reference.html - UITableView Class Reference

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableViewDelegate_Protocol/Reference/Reference.html - UITableViewDelegate Protocol Class Reference

http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewDataSource_Protocol/Reference/Reference.html - UITableViewDataSource Protocol Class Reference

Also, take a look at this sample code:

http://developer.apple.com/library/ios/ipad/#samplecode/TableViewSuite/Introduction/Intro.html


The UITableViewDataSource and UITableViewDelegate are usually set on the ViewController. If you are using a UITableView within a UIViewController you need to implement the delegate and datasource in the interface file (*.h)

@interface YourViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

Once you have the delegate declared you can implement 3 methods to make the tableview work

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

Need Your Help

getting embedded flowplayer to play a local video file

html video flowplayer object-tag

I embedded flowplayer on an html page using the following &lt;object tag .It successfully plays the mentioned video from their site (ie from url http://stream.flowplayer.org/KimAronson-TwentySecond...