I haven't developed any iOS apps in a while. I am fine with both swift and Objective-C but what I find different is adding a UITableView
to ViewController. Before, I used to add a UITableView
to ViewController, add the required datasource methods and the typical UITableViewCell
object, and return the cell in cellForRowAtIndexPath:
, which would display empty cells depending on the number of rows I return. Now, I did everything the same, but the UITableView
is empty and when I scroll I see the lines but not my cell.textlabel.text
value, which I set. It seems now I am supposed to add UITableViewCell
to the UITableView
and remove the
#pragma-mark TableView Datasource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [_formTitles count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:@"cell"];
if(cell==NULL)
{
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
}
cell.textLabel.text=[_formTitles objectAtIndex:indexPath.row];
cell.detailTextLabel.text=@"Kaushik";
return cell;
}
I can't find a simple post online regarding the same. Can someone post what are the changes in the new iOS 9 in a simple manner? Thank you
dequeueReusableCellWithIdentifier
will always return a cell, even if it needs to allocate one for you. Can you show more code?cellForRowAtIndexPath
. You can also allocate and return cells yourself even if you are using a storyboard, but you wouldn't. Can you show your fullcellForRowAtIndexPath
?