Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 05-01-2008, 11:15 AM   #1 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 298
Default SMS balloon cell??

Hi,
I was just wondering if anyone has a created a SMS type balloon cell for their application. If so, will you be able to share your code? I am just too bad at Graphics and Animations and any help is greatly appreciated.

Thanks,
Javid
javid.alimohideen is offline   Reply With Quote
Old 05-14-2008, 04:15 PM   #2 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 298
Default Re: SMS balloon cell??

Finally, I was able to figure out how to draw a balloon cell as a background for my table view cell. If anyone is looking for code it is very sraightforward. I have attached a balloon image incase you need one.

Code:
-(void)drawRect:(CGRect) aRect {
   UIImage* balloon = [[UIImage imageNamed:@"balloon.png"] stretchableImageWithLeftCapWidth:15  topCapHeight:15]; // you need to have the .png image, it's not a system one.
  [balloon drawInRect: aRect];
}
javid.alimohideen is offline   Reply With Quote
Old 05-14-2008, 08:27 PM   #3 (permalink)
Registered Member
 
Join Date: Apr 2008
Posts: 93
Default Re: SMS balloon cell??

That just might come in handy in one of my apps.

Thanks.
BuschyBoy is offline   Reply With Quote
Old 05-15-2008, 12:48 AM   #4 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 802
Default Re: SMS balloon cell??

Thanks for sharing. I don't need it for anything now but it could be useful on future projects.
scottiphone is offline   Reply With Quote
Old 06-17-2008, 02:59 AM   #5 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 53
Default Re: SMS balloon cell??

Quote:
Originally Posted by javid.alimohideen
Finally, I was able to figure out how to draw a balloon cell as a background for my table view cell. If anyone is looking for code it is very sraightforward. I have attached a balloon image incase you need one.

Code:
-(void)drawRect:(CGRect) aRect {
   UIImage* balloon = [[UIImage imageNamed:@"balloon.png"] stretchableImageWithLeftCapWidth:15  topCapHeight:15]; // you need to have the .png image, it's not a system one.
  [balloon drawInRect: aRect];
}
how did you attach it to a uitablviewcell?
turinreza is offline   Reply With Quote
Old 06-17-2008, 09:54 AM   #6 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 298
Default Re: SMS balloon cell??

You extend UITableViewCell and override the drawRect method..

Code:
MyTableViewCell : UITableViewCell

-(void) drawRect:
{
  // the code goes here.
}
javid.alimohideen is offline   Reply With Quote
Old 06-17-2008, 03:07 PM   #7 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 53
Default Re: SMS balloon cell??

thanks..
but whenever i write somethign to the cell the image gets clipped
it seems that the text is blocking the image ...
anyway you fixed that?
TIA

Quote:
Originally Posted by javid.alimohideen
You extend UITableViewCell and override the drawRect method..

Code:
MyTableViewCell : UITableViewCell

-(void) drawRect:
{
  // the code goes here.
}
turinreza is offline   Reply With Quote
Old 07-30-2008, 08:35 AM   #8 (permalink)
Registered Member
 
Join Date: Jul 2008
Posts: 34
Default

Hi Javid,

I could not find your attached balloon.png?
Could you please send me the file? Or let me know where can I get it?
Thanks a lot.

Last edited by victor_zzm; 07-30-2008 at 08:50 AM.
victor_zzm is offline   Reply With Quote
Old 09-30-2008, 04:03 PM   #9 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 298
Default

Sorry about not responding. I have been away for past few months and was not able to participate or develop any iPhone related code for a while. I have uploaded the ballooncell image file.

Sorry again,
Javid
Attached Images
File Type: png ballooncell.png (1.7 KB, 310 views)
javid.alimohideen is offline   Reply With Quote
Old 10-24-2008, 11:48 PM   #10 (permalink)
Registered Member
 
Join Date: Aug 2008
Posts: 36
Default

Could someone post some code with this added. Please Please Please Please Please Please Please Please Please Please Please Please PPPPPPPPPPPPPPPPPPPPPPPllllllllllllllllllllllleeee eeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaassssssssssss sssssseeeeeeeeeeeeeeeeeeeeeee
MacBuddy is offline   Reply With Quote
Old 10-26-2008, 01:20 PM   #11 (permalink)
ash
Ashar
 
Join Date: Aug 2008
Posts: 54
Default

Hi Guys

Actually i wanted to make a screen similar to the iPhone SMS screen, the part where the user can enter the message (the textfield expands as a message is entered)

Any help would be appreciated.

--
Thanks
ash is offline   Reply With Quote
Old 03-14-2009, 03:38 AM   #12 (permalink)
UK based App Developers
 
Join Date: Feb 2009
Location: Bath, UK
Posts: 42
Default SMS

Yeah I could do with the same thing. I'm trying to learn iPhone development so if anyone does manage to get a project that visually looks like the SMS please post a link here.

Thanks! ;-)

Steve
YARG is offline   Reply With Quote
Old 03-24-2009, 10:15 AM   #13 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 15
Default

How did you manage for the backgournd to fit the content? specially the width of the baloon?
yecine06 is offline   Reply With Quote
Old 05-05-2009, 05:04 PM   #14 (permalink)
Registered Member
 
Join Date: Oct 2008
Posts: 91
Default

Quote:
Originally Posted by yecine06 View Post
How did you manage for the backgournd to fit the content? specially the width of the baloon?
Here is how I did it....

Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	
	ThreadSCell *cell = (ThreadSCell*)[tableView dequeueReusableCellWithIdentifier:@"MsgListCell"];
	
	// If no cell is available, create a new one using the given identifier
	if (cell == nil) {
		cell = [[[ThreadSCell alloc] initWithFrame:CGRectMake(0,0,0,0) reuseIdentifier:@"MsgListCell"] autorelease];
		cell.accessoryType = UITableViewCellAccessoryNone;
	}
	
	
	
	NSMutableDictionary *tempMsg = [myMessages objectAtIndex:indexPath.row];
	
	
	CGFloat	result = 20.0;
	CGSize	textSize = { 260.0, 20000.0 };		// width and height of text area
	
	NSMutableDictionary *dict = [myMessages objectAtIndex:indexPath.row];
	NSString *aMsg = [dict objectForKey:@"msgBody"];
	
	CGSize size = [aMsg sizeWithFont:[UIFont systemFontOfSize:13.0] constrainedToSize:textSize lineBreakMode:UILineBreakModeWordWrap];
	
	result = MAX(size.height + 20, 30.0);
	//NSLog(@"Height for row2:%i %f", indexPath.row, result);
	
	// Set the cell properities 
	[cell.msgText setText:[tempMsg objectForKey:@"msgBody"]];
	[myTable setSeparatorStyle:UITableViewCellSeparatorStyleNone];
	[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
	if ( indexPath.row % 2 == 0 ) {
		 
		
		[cell.msgText setFrame:CGRectMake(20.0, 0.0, size.width, cell.frame.size.height-10)];
		//[cell.msgText setBackgroundColor:[UIColor colorWithRed:.788 green:.788 blue:.788 alpha:1]];
		//[cell.msgText setText:[NSString stringWithFormat:@"H1: %f H2: %f", result, cell.frame.size.height]];
		
		UIImage* balloon = [[UIImage imageNamed:@"msgGray.png"] stretchableImageWithLeftCapWidth:24  topCapHeight:15];
		UIImageView *newImage = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, size.width+35, size.height+20)];
		UIView *newView =[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, cell.frame.size.width, cell.frame.size.height)];

		[newImage setImage:balloon];
		[newView addSubview:newImage];
		[cell setBackgroundView:newView];
		
        
		
	}
Basically I create a view the same size as the cell, and a view the size of the balloon. add the balloon view to the cell view and it works. Its kinda hacked together but its good enough for now.
pcmofo is offline   Reply With Quote
Old 05-31-2009, 11:29 AM   #15 (permalink)
New Member
 
Join Date: May 2009
Posts: 2
Default

Hi-
This is perfect, works exactly as expected. But how can I make it respond to orientation changes? I tried setting the width to a value based on the cell size, but it still doesn't change on rotate.

Thanks!

John

Quote:
Originally Posted by pcmofo View Post
Here is how I did it....

Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	
	ThreadSCell *cell = (ThreadSCell*)[tableView dequeueReusableCellWithIdentifier:@"MsgListCell"];
	
	// If no cell is available, create a new one using the given identifier
	if (cell == nil) {
		cell = [[[ThreadSCell alloc] initWithFrame:CGRectMake(0,0,0,0) reuseIdentifier:@"MsgListCell"] autorelease];
		cell.accessoryType = UITableViewCellAccessoryNone;
	}
	
	
	
	NSMutableDictionary *tempMsg = [myMessages objectAtIndex:indexPath.row];
	
	
	CGFloat	result = 20.0;
	CGSize	textSize = { 260.0, 20000.0 };		// width and height of text area
	
	NSMutableDictionary *dict = [myMessages objectAtIndex:indexPath.row];
	NSString *aMsg = [dict objectForKey:@"msgBody"];
	
	CGSize size = [aMsg sizeWithFont:[UIFont systemFontOfSize:13.0] constrainedToSize:textSize lineBreakMode:UILineBreakModeWordWrap];
	
	result = MAX(size.height + 20, 30.0);
	//NSLog(@"Height for row2:%i %f", indexPath.row, result);
	
	// Set the cell properities 
	[cell.msgText setText:[tempMsg objectForKey:@"msgBody"]];
	[myTable setSeparatorStyle:UITableViewCellSeparatorStyleNone];
	[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
	if ( indexPath.row % 2 == 0 ) {
		 
		
		[cell.msgText setFrame:CGRectMake(20.0, 0.0, size.width, cell.frame.size.height-10)];
		//[cell.msgText setBackgroundColor:[UIColor colorWithRed:.788 green:.788 blue:.788 alpha:1]];
		//[cell.msgText setText:[NSString stringWithFormat:@"H1: %f H2: %f", result, cell.frame.size.height]];
		
		UIImage* balloon = [[UIImage imageNamed:@"msgGray.png"] stretchableImageWithLeftCapWidth:24  topCapHeight:15];
		UIImageView *newImage = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, size.width+35, size.height+20)];
		UIView *newView =[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, cell.frame.size.width, cell.frame.size.height)];

		[newImage setImage:balloon];
		[newView addSubview:newImage];
		[cell setBackgroundView:newView];
		
        
		
	}
Basically I create a view the same size as the cell, and a view the size of the balloon. add the balloon view to the cell view and it works. Its kinda hacked together but its good enough for now.
jumpingGrendel is offline   Reply With Quote
Old 06-01-2009, 09:49 AM   #16 (permalink)
New Member
 
Join Date: May 2009
Posts: 2
Default

Ah, I found it: autoresizingMask

Thanks,

John

Quote:
Originally Posted by jumpingGrendel View Post
Hi-
This is perfect, works exactly as expected. But how can I make it respond to orientation changes? I tried setting the width to a value based on the cell size, but it still doesn't change on rotate.

Thanks!

John
jumpingGrendel is offline   Reply With Quote
Old 07-12-2009, 02:44 PM   #17 (permalink)
New Member
 
Join Date: Jul 2009
Posts: 1
Default Permissions issue

Quote:
Originally Posted by javid.alimohideen View Post
Sorry about not responding. I have been away for past few months and was not able to participate or develop any iPhone related code for a while. I have uploaded the ballooncell image file.

Sorry again,
Javid
I don't seem to have permission to download this image. Has anyone else had an issue with that?
timothy1ee is offline   Reply With Quote
Old 07-16-2009, 12:47 PM   #18 (permalink)
New Member
 
Join Date: Jul 2009
Posts: 1
Default

Can someone please repost the image
vkailas is offline   Reply With Quote
Old 07-31-2009, 12:49 AM   #19 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 11
Default

am not able to see the attachment when I login?
codetiger is offline   Reply With Quote
Old 07-31-2009, 12:51 AM   #20 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 11
Default

Did you design the image or you got it somewhere? I guess I need the default apple image?
codetiger is offline   Reply With Quote
Old 07-31-2009, 03:06 AM   #21 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 11
Default

now, I got the images from some other website...

another doubt...
whats ThreadSCell in the code posted?
codetiger is offline   Reply With Quote
Old 09-07-2009, 10:19 AM   #22 (permalink)
Registered Member
 
gblank's Avatar
 
Join Date: Oct 2008
Location: Netherlands
Posts: 35
Send a message via Skype™ to gblank
Default Links to the baloons images

Quote:
Originally Posted by codetiger View Post
now, I got the images from some other website...

another doubt...
whats ThreadSCell in the code posted?
Customize the SMS Bubbles | George Zhu's BLOG
gblank is offline   Reply With Quote
Old 04-02-2010, 07:59 AM   #23 (permalink)
Registered Member
 
AcidumIrae's Avatar
 
Join Date: Apr 2010
Posts: 1
Default

Just in case anybody needs it: implementation
AcidumIrae is offline   Reply With Quote
Old 04-02-2010, 09:48 AM   #24 (permalink)
Obj-C Learner
 
Join Date: Apr 2009
Location: Manchester, UK
Posts: 1,030
Send a message via MSN to ZunePod Send a message via Yahoo to ZunePod
Default

Quote:
Originally Posted by AcidumIrae View Post
Just in case anybody needs it: implementation
They don't look very glossy.
__________________
Will code for food
ZunePod is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UITableViewCell height set at cell creation Cander iPhone SDK Development 8 10-22-2008 09:54 AM
Easily customize table cell. pendraggon87 iPhone SDK Development 4 07-04-2008 08:06 AM
Table cell refresh through timer mademo iPhone SDK Development 6 06-01-2008 02:43 PM


» Advertisements
» Stats
Members: 157,859
Threads: 88,915
Posts: 379,298
Top Poster: BrianSlick (7,072)
Welcome to our newest member, Hom3brEwli2s1
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:53 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0