<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Emmer Inc &#187; UITableViewCell</title>
	<atom:link href="http://blog.emmerinc.be/index.php/tag/uitableviewcell/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.emmerinc.be</link>
	<description>Tales from a .NET developer who's making the jump to the iPhone &#38; App Store wonderland.</description>
	<lastBuildDate>Wed, 23 Jun 2010 20:57:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Multiline cells in iPhone SDK 3.0</title>
		<link>http://blog.emmerinc.be/index.php/2009/06/21/multiline-cells-in-iphone-sdk-3-0/</link>
		<comments>http://blog.emmerinc.be/index.php/2009/06/21/multiline-cells-in-iphone-sdk-3-0/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 13:46:21 +0000</pubDate>
		<dc:creator>Yannick Compernol</dc:creator>
				<category><![CDATA[Cocoa Touch]]></category>
		<category><![CDATA[iPhone SDK 3.0]]></category>
		<category><![CDATA[UITableViewCell]]></category>

		<guid isPermaLink="false">http://blog.emmerinc.be/?p=520</guid>
		<description><![CDATA[While surfing the web and browsing through development related forums, I encountered a lot of questions regarding multiline UITableViewCells. Prior to iPhone SDK 3.0 this was not an easy feat and although it is very common in UIs, the work that is related to creating multiline cells is not  proportional to how common they [...]]]></description>
			<content:encoded><![CDATA[<p>While surfing the web and browsing through development related forums, I encountered a lot of questions regarding multiline UITableViewCells. Prior to iPhone SDK 3.0 this was not an easy feat and although it is very common in UIs, the work that is related to creating multiline cells is not  proportional to how common they are.</p>
<p>Apple definitely made it easier with new SDK, since we can interact directly with the UILabel. I know it&#8217;s pretty straightforward, but I&#8217;m always surprised by how many developers disregard the <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableViewCell_Class/Reference/Reference.html">documentation</a> &#038; turn to forums/blogs for help.</p>
<p>Creating multiline cells is now as simple as setting the numberOfLines property to 0 (or a predefined number) of the textLabel, which is in turn a property of the cell. Given the height of the cell is sufficient, behold a multiline cell.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">cell.textLabel.text <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Some long text...&quot;</span>;
cell.textLabel.numberOfLines <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;</pre></div></div>

<p>Change the height of the cell with the tableView:heightForRowAtIndexPath: delegate method of the UITableViewController, either by returning a fixed height or by calculating the height needed to show the desired text.</p>
<p>Note that the text property of a cell is being deprecated in favor of textLabel.text, more info on the new 3.0 predefined cell styles can be found <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableViewCell_Class/Reference/Reference.html#//apple_ref/c/tdef/UITableViewCellStyle">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.emmerinc.be/index.php/2009/06/21/multiline-cells-in-iphone-sdk-3-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
