Virat Naithani
Virat Naithani

Reputation: 783

how to customize UITableViewCell

i want to customize table cell to show data like this (chk image) enter image description here

Upvotes: 0

Views: 2867

Answers (4)

Thomas K
Thomas K

Reputation: 6216

You can subclass UITableViewCell.

In Xcode -> New File -> Objective-C class -> Subclass of UITableViewCell

Then in your tableview at cellForRowAtIndexPath:

 static NSString *CellIdentifier = @"Cell";

   MySubclassedTableviewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[MySubclassedTableviewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell...

    return cell;

Upvotes: 1

Ishu
Ishu

Reputation: 12787

For those rows which you want set color like above the simply set this color (shown in above pic) fo cell' background color.

or find this color use digital meter and use that rgb. like this

[UIColor colorWithRed:200.0/255 green:200.0/255 blue:200.0/255 alpha:1.0];

replace 200.0 with your rgb values

waht you need, you need to store data in common array for simply showing single detail you need to save that in form of string others in dictionary format. And at time of showing data.

check wheter object is string or dictionary, and show accordingly.

for checking type of object use this

if([[myArray objectAtIndex:index] isKindOfClass:[NSString class]])

Upvotes: 3

jigneshbrahmkhatri
jigneshbrahmkhatri

Reputation: 3637

You can implement delegate method of viewForHeaderInSection: and implement view for yellow area shown in screenshot, and for for rest, you can implement custom table view cell inherited from UITableViewCell

Upvotes: 1

Rakesh Bhatt
Rakesh Bhatt

Reputation: 4606

Use custom tableviewcell

Upvotes: 0

Related Questions