I have a tableview with external delegate controller. Despite content table view array is well populated, and numberOfSectionsInTableView:
and
-tableView: numberOfRowsInSection:
are called,
but-tableView: cellForRowAtIndexPath:
is not called.
Issued table view is set in that ways:
CompeticionViewController.h
....
@property (retain, nonatomic) IBOutlet UITableView *calendarioTable;
@property (strong, nonatomic) calendarioViewController *calendarioController;
....
calendarioTable = [[UITableView alloc] init];
calendarioController = [[calendarioViewController alloc] init];
[calendarioTable setDelegate:calendarioController];
[calendarioTable setDataSource:calendarioController];
calendarioController.calendarioArray = [[NSMutableArray alloc] init];
[calendarioController.calendarioArray addObjectsFromArray: self.calendarioarray];
[calendarioTable reloadData];
EDITED:
calendarioViewController.m
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [calendarioArray count];
}
Many thanks
Datasource methods are used to generate tableView cells,header and footer before they are displaying.. Delegate methods provide information about these cells, header and footer along with other user action handlers like cell selection and edit..
func tableView(UITableView, willDisplay: UITableViewCell, forRowAt: IndexPath) Tells the delegate the table view is about to draw a cell for a particular row. func tableView(UITableView, indentationLevelForRowAt: IndexPath) -> Int. Asks the delegate to return the level of indentation for a row in a given section.
UITableView manages the basic appearance of the table, but your app provides the cells ( UITableViewCell objects) that display the actual content. The standard cell configurations display a simple combination of text and images, but you can define custom cells that display any content you want.
The tableview is the instance of the UITableView class, which inherits the UIScrollView class. We will discuss UIScrollView in the upcoming chapters of this tutorial. In iOS applications, whenever we need to display the single column containing vertically scrolling content, we use tableview.
In .xib file link delegate and datasource with File's owner or write
tableview.delegate=self
tableview.datasource=self;
You have used IBOulet
for tableview
then why are u allocating
it as its not need memory already allocated
.
Now check in xib
of your view controller that tableview
is binded
and its delegate
and datasource
provided to file owner
.
-----------------------------------------OR------------------------------------------------
add
this line in viewDidLoad method
yourtableview.delegate=self
yourtableview.datasource=self;
Now After using IBOulet
for tableview
you will have bind it with file owner and ViewController interface implements
both the <UITableViewDelegate>
and <UITableViewDataSource>
protocols
Now check array
you are providing
to tableview
has content
in it
Edit : Add OR code and done formatting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With