1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Nevermind Got It!!!!!

Discussion in 'iPhone/iPad Programming' started by DSchwartz88, Jul 25, 2008.

  1. macrumors 6502

    #1
    Hey All,

    I know, i know, i can already hear some of you saying "man this guy asks to many questions".

    Anyways,

    I have a part of my app that displays comments from a website. Right now each of these is encapsulated in a little sms style bubble (Thanks to grimjim, hes awesome). I am wondering how i can make them alternate so it looks like a conversation (Different colors, direction, etc.). Im attaching both a screen shot and the code i use to draw it all out. Thanks in advance

    Daniel

    Image:

    http://img329.imageshack.us/my.php?image=ssef0.png


    CODE:

    Code:
    UIImage *bubble1 = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"AquaLarge" ofType:@"png"]];
    		UIImageView *bubble2 = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 50.0)];
    		bubble2.image = bubble1;
    		
    		UILabel *lb1 = [[UILabel alloc] initWithFrame:CGRectMake(15.0, 3.0, 300.0, 21.0)];
    		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(15.0, 27.0, 300.0, 10.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 addSubview:bubble2];
    		[cell addSubview:lb1];
    		[cell addSubview:lb2];
    
     

Share This Page