Hello,
I want to display multiple column on UITableView.
For Example:
TableView
FName LName Age
----- ----- ---
Abby Michale 34
Thanks in advanced
Annpurna
Hello,
I want to display multiple column on UITableView.
For Example:
TableView
FName LName Age
----- ----- ---
Abby Michale 34
Thanks in advanced
Annpurna
Create a custom UIView
subclass containing, say, three UILabel
elements as subviews. Then set the cell's contentView
property to this custom view.
You can define a custom cell in IB, which will contain 3 labels and in function:
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *DetailCellIdentifier = @"DetailCell";
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:DetailCellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"DetailCell" owner:self options:nil];
}
// setup your cell
}
when you define the cell in IB give each label a tag, so when you need to put a text there you can retrieve it by tag like this:
label = (UILabel *)[cell viewWithTag:NAME_TAG];
label.text = myObject.name;
and repeat this with other 2 labels. The tag is a unique number.
Put this code instead //setup your cell comment