tags:

views:

214

answers:

1

Hi,

I am creating 30 UIButtons dynamically for my custom calender in iphone application. I am also adding the UILabel as a subview in each of UIButton. I am setting different background color for each of the UILabels.

When i try to change the background color of UILabel then on some of the iPhone device it is working fine but on some of iPod touch and iPhone device is is not displaying any color. It behaves like i set clearColor.

Here is my basic code to load one cell. I have kept this logic in loop and i am using UIButton array to create multiple cells:

calenderCell = [UIButton buttonWithType:UIButtonTypeCustom];
calenderCell.frame = CGRectMake(xOffset, yOffset, cellWidth, cellHeight);
calenderCell.backgroundColor = [UIColor clearColor];
[calenderCell addTarget:self action:@selector(calenderCellClicked:)  
                          forControlEvents:UIControlEventTouchUpInside];

calenderCellDate=[[UILabel alloc] initWithFrame:CGRectMake(1.0,1.0, cellWidth-1.0, cellHeight-1.0)];
calenderCellDate.text = [NSString stringWithFormat:@"%ld",dateValue];
calenderCellDate.textAlignment = UITextAlignmentCenter;
calenderCellDate.font = [UIFont fontWithName:@"Trebuchet MS" size:15.0];
calenderCellDate.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1.0];
calenderCellDate.textColor = [UIColor colorWithRed:0.44 green:0.44 blue:0.44 alpha:1.0];
[calenderCell addSubview:calenderCellDate];
[calenderCellDate release];

can anyone have idea what is wrong with this code?

Appreciate your help.

Thanks,
Jim.

A: 

I figure it out. There is problem related to regional and locale settings. For US it is working fine but for other region like china,germany,italy above code was not executed due to some comparisons of dates.

Everything is ok with that code.

Thanks,
Jim.

Jim