last day (14 days later) » 

12:36 PM
0
A: How can i set two background colours for a single row

balkaran singhplz take two label in uitableview cell and you can access them UILabel *label =(UILabel *)[cell viewWithTag:yourtagnumber]; set this identifier value , and set the style to custom the in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath...

 
yes i have tried this way but i don't know why it was not showing see the 3 commented lines below in my code section
 
what the mena of this line UITableViewCell* cell = self.myTableViewCells[indexPath.row];
plz access your cell with UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"your idetifier"];
 
see the full code now this is the only code i am using full code, with UITableViewCell* cell = self.myTableViewCells[indexPath.row]; line meaning
 
are you using storyboard or not ?
 
yes i am using storyboard
 
12:36 PM
chek update answer @vicky ?
 
but if i use the reusable cell with identifief the same value repeats in every cell which i don't want thats why i create the myTableViewCell for setting each cell the value i wanted.
thats why i am using fixed number of cells
 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
[_myTableViewCells objectAtIndex:indexPath.row] forIndexPath:indexPath];
 
should i use this code for cell now
 
and set conditions with if ([[_myTableViewCells objectAtIndex:indexPath.row] isEqualToString:@"yourfirstcell"] && indexPath.row == 0)
{ }
for all cells you can set this conditions .
 
what is the @"yourfirstcell"
 
12:47 PM
it is your identifier value of your first cell
that you set from storyboard
 
and where should i set these conditions
 
in cellForRowAtIndexPath methods
i give you example
 
but i did not set the identifiers for my cell they are actually nil. in NSArray which i have created
 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
@try {
DashboardCell *cell = [tableView dequeueReusableCellWithIdentifier:
[arrDashboardCell objectAtIndex:indexPath.row] forIndexPath:indexPath];


cell.delegate = self;
if ([[arrDashboardCell objectAtIndex:indexPath.row] isEqualToString:Cell_Profile] && indexPath.row == 0)
{

}
else if ([[arrDashboardCell objectAtIndex:indexPath.row] isEqualToString:Cell_MemberShip] && indexPath.row == 1)
{
so plese set it
 

last day (14 days later) »