badgeColor and badgeTextColor do not change color :( #21

Closed
ilmetu opened this Issue Jan 26, 2013 · 4 comments

Comments

Projects
None yet
3 participants

ilmetu commented Jan 26, 2013

hi,

this is awesome work guys ! thanks for doing this :)

i try to implement the tdbadgecell in my little project and it works, but i'm unable to change the color about the badge and the text in the badge.

i try to use this code :

cell.badgeColor = [UIColor whiteColor];
cell.badgeTextColor = [UIColor blackColor];

but nothing happend, it just change color when i tap the cell.

Thanks for any help.
(sorry for my bad english)

Owner

tmdvs commented Jan 28, 2013

Can you provide a code example of where you're making these calls?

ilmetu commented Jan 28, 2013

Hi, thanks for the answer, this is the code i use to color the badge and the badgetext.

In this case i use the LEColorPicker library but if i use the sample call :

cell.badgeColor = [UIColor whiteColor];
cell.badgeTextColor = [UIColor blackColor];

do not work :( thanks for any help :)

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

 NSArray *details = [[self.questions objectAtIndex:indexPath.row] componentsSeparatedByString:@"@_@"];
 NSString *summary = [details objectAtIndex:1];
 NSString *nickname = [details objectAtIndex:2];
 NSString *img_avatar_string = [details objectAtIndex:4];
 NSString *answers = [details objectAtIndex:7];

    static NSString *CellIdentifier = @"Cell";

    TDBadgedCell *cell = [[TDBadgedCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];

    NSString *img_url = [[NSString alloc] initWithFormat:@"http://XXXX.XXX/%@",img_avatar_string];

    [cell.imageView setImageWithURL:[NSURL URLWithString:img_url]
               placeholderImage:[UIImage imageNamed:@"loading_image.png"]];


   if ([[details objectAtIndex:8] isEqualToString:@"1"]){
       [LEColorPicker pickColorFromImage:cell.imageView.image onComplete:^(NSDictionary *colorsPickedDictionary) {
        [UIView beginAnimations:@"ColorChange" context:nil];
        [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
        [UIView setAnimationDuration:0.5];

        cell.backgroundColor = [colorsPickedDictionary objectForKey:@"BackgroundColor"];
        cell.textLabel.textColor = [colorsPickedDictionary objectForKey:@"PrimaryTextColor"];
        cell.detailTextLabel.textColor = [colorsPickedDictionary objectForKey:@"SecondaryTextColor"];
        cell.badgeColor = [colorsPickedDictionary objectForKey:@"PrimaryTextColor"];
        cell.badgeTextColor = [colorsPickedDictionary objectForKey:@"SecondaryTextColor"];

           [UIView commitAnimations];
       }];
   }

   cell.badgeString = answers;

   if ([summary length] > 20) {
           cell.textLabel.text = [NSString stringWithFormat:@"%@...",[summary substringWithRange:NSMakeRange(0, 20)]];
   }else{cell.textLabel.text = summary;}

   cell.detailTextLabel.text = nickname;
   cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

   //cell.showShadow = YES;

   return cell;
 }  

@tmdvs tmdvs closed this Mar 13, 2013

What was the solution to this? Having the same issue. Thanks in advance!

Owner

tmdvs commented Oct 10, 2013

@danmorganshoeboxed This issue is almost a year old and many changes have taken place. Can you provide me with an example? If the badge colours are changing in the demo project then the should do for you too.

@tmdvs tmdvs reopened this Oct 10, 2013

@tmdvs tmdvs closed this Oct 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment