Reputation: 243
i am working in an project in which i have to create a facebook like newsfeed view after hours of R&D i choose to use prototype cells in UITableView for newsfeed view now the problem in row 1 i have to show only single information whereas in second cell i have to pass an array which have multiple elements like in fb wall. in which the content of second cell is changes as par array size and first cell remain unchanged. please suggest me any other way how can i perform all this.
currently i am using the following code in tableview delegate methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 2;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *identifier;
if (indexPath.row == 0)
{
identifier = @"OneCellId";
}
else if (indexPath.row == 1)
{
identifier = @"OtherCellId";
}
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
return cell;
}
Upvotes: 0
Views: 73
Reputation: 4402
Yes you can use prototype cells as you are using, just dequeue as per your requirement and for dynamic height you can refer UITableViewCell with dynamic height iOS
Upvotes: 0