SMS Style Bubbles in UITableViewCell
Hey All,
Im trying to get my UITableViewCell's to display with a SMS style "balloon" around them. Ive brought in the image as a UIImage, then added that image to a UIImageView, then tried to add the UIImageView as a subview of cell.backgroundView.
This isnt working currently. Im attaching my code so you all can take a look and let me know why this isnt working!! I hate debugging!!! Anyways any help would be very appreciated, im new at iPhone programming, so please let me know if im making stupid mistakes.
Thanks,
Daniel
CODE:
UIImage *bubble1 = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"aqua" ofType:@"png"]];
UIImageView *bubble2 = [[UIImageView alloc] initWithFrame:cell.frame];
bubble2.image = bubble1;
UILabel *lb1 = [[[UILabel alloc] initWithFrame:CGRectMake(5.0, 8.0, 70.0, 15.0)] autorelease];
lb1.font = [UIFont boldSystemFontOfSize:12.0];
lb1.textAlignment = UITextAlignmentLeft;
lb1.textColor = [UIColor blueColor];
lb1.backgroundColor = [UIColor clearColor];
lb1.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;
lb1.text = [[[comments items] objectAtIndex:indexPath.row] objectForKey:@"dc:creator"];
//[cell.contentView addsubview:bubble2];
[cell.contentView addSubview:lb1];
UILabel *lb2 = [[[UILabel alloc] initWithFrame:CGRectMake(5.0, 28.0, 280.0, 15.0)] autorelease];
lb2.font = [UIFont systemFontOfSize:12.0];
lb2.textAlignment = UITextAlignmentLeft;
lb2.textColor = [UIColor blackColor];
lb2.backgroundColor = [UIColor clearColor];
lb2.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;
lb2.text = [[[comments items] objectAtIndex:indexPath.row] objectForKey:@"description"];
[cell.contentView addSubview:lb2];
[cell.backgroundView addSubview:bubble2];
[cell setNeedsDisplay];
and of course i return the cell at the end.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules