<?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>あらびき林檎。 &#187; UITableView</title>
	<atom:link href="http://splitchin.com/tech/tag/uitableview/feed/" rel="self" type="application/rss+xml" />
	<link>http://splitchin.com/tech</link>
	<description>Macや, iPhoneでの,Webデザイン,アプリ開発などを綴ってます。</description>
	<lastBuildDate>Sun, 06 May 2012 01:09:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>iPhoneアプリ　UITableViewを試す。</title>
		<link>http://splitchin.com/tech/2010/03/14/iphone%e3%82%a2%e3%83%97%e3%83%aa%e3%80%80uitableview%e3%82%92%e8%a9%a6%e3%81%99%e3%80%82/</link>
		<comments>http://splitchin.com/tech/2010/03/14/iphone%e3%82%a2%e3%83%97%e3%83%aa%e3%80%80uitableview%e3%82%92%e8%a9%a6%e3%81%99%e3%80%82/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 13:18:45 +0000</pubDate>
		<dc:creator>arakkyee</dc:creator>
				<category><![CDATA[Object-C]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK 3]]></category>
		<category><![CDATA[iPhoneアプリ]]></category>
		<category><![CDATA[Objective-c]]></category>
		<category><![CDATA[UITableView]]></category>

		<guid isPermaLink="false">http://splitchin.com/tech/?p=888</guid>
		<description><![CDATA[				「Macを買うなら…」でおなじみの、秋葉館オンラインショップ
				もちろん話題のiPodも本体を含め関連商品充実！ 
				
				色々と大変そうなので、避けていたのですが、
				UITableVie [...]]]></description>
			<content:encoded><![CDATA[				<p>「Macを買うなら…」でおなじみの、<a href="http://px.a8.net/svt/ejp?a8mat=1NLQR5+AV5URM+BEK+5ZEMQ" target="_blank">秋葉館オンラインショップ</a><br />
				もちろん話題のiPodも本体を含め関連商品充実！ <img src="http://www12.a8.net/0.gif?a8mat=1NLQR5+AV5URM+BEK+5ZEMQ" border="0" alt="" width="1" height="1" /><br />
				<img class="alignnone size-full wp-image-889" title="TableView01" src="http://splitchin.com/tech/wp-content/uploads/2010/03/TableView01.png" alt="UITableView" width="200" height="367" /></p>
				<p>色々と大変そうなので、避けていたのですが、</p>
				<p>UITableViewの基礎を試してみました。<br />
				こちらをベースに色々カスタマイズしてみようと思います。</p>
				<ul>
				<li><a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableViewDataSource_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UITableViewDataSource/tableView:cellForRowAtIndexPath:">tableView:cellForRowAtIndexPath:</a> メソッド<br />
				indexPathが指定する位置のUITableViewCellのインスタンスを返すようにする。</li>
				<li><a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableViewDataSource_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UITableViewDataSource/tableView:numberOfRowsInSection:">tableView:numberOfRowsInSection:</a> メソッド<br />
				テーブルが保持するセルの数を返すようにする。</li>
				</ul>
				<p><a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableViewDataSource_Protocol/Reference/Reference.html" target="new">iPhone Dev Center: UITableViewDataSource Protocol Reference</a>より</p>
				<pre class="brush: cpp;">
@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
	self.title =@&quot;UITableView　聖域十二宮編&quot;;

	//Tableに表示する要素
	items_ = [[NSArray alloc] initWithObjects:
			 @&quot;１月　山羊座 - Capricornus&quot;, @&quot;２月　水瓶座 - Aquarius&quot;,@&quot;３月　魚座 - Pisces&quot;,
			 @&quot;４月　牡羊座 - Aries&quot;, @&quot;５月　牡牛座 - Taurus&quot;, @&quot;６月　双子座 - Gemini&quot;,
			 @&quot;７月　蟹座 - Cancer&quot;, @&quot;８月　獅子座 - Leo&quot;, @&quot;９月　乙女座 - Virgo&quot;,
			 @&quot;１０月 天秤座 - Libra&quot;, @&quot;１１月　蠍座 - Scorpio&quot;, @&quot;１２月　射手座 - Sagittarius&quot;,
			 nil];
}
&lt;pre&gt;//Viewのリリースに、要素の配列をリリース&lt;/pre&gt;
- (void)viewDidUnload {
 [items_ release];
}

// テーブルが持っているセルの数を返す
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
 return [items_ count];
}

// UiTableViewCellのインスタンスを返す
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

 static NSString *CellIdentifier = @&quot;Cell&quot;;

 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
 if (cell == nil) {
 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
 }

 // Configure the cell.

 cell.textLabel.text = [items_ objectAtIndex:indexPath.row];

 return cell;
}
</pre>
				<p><img class="alignnone size-full wp-image-892" src="http://splitchin.com/tech/wp-content/uploads/2010/03/TableView02.png" alt="TableView02" width="200" height="346" /></p>
				<p>セルの選択時にアクションを発生させるには、didSelectedRowAtIndexPathメソッドをオーバライドします。</p>
				<pre class="brush: cpp;">
// セルの選択をハンドリングしてアクションを発生させる
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

	NSString* message = [items_ objectAtIndex:indexPath.row];
	UIAlertView* alert = [[[UIAlertView alloc] init] autorelease];
	alert.message = message;
	[alert addButtonWithTitle:@&quot;OK&quot;];
	[alert show];
}
</pre>
				<p><!-- amazon --></p>
				<p><!-- /Amazon --></p>
]]></content:encoded>
			<wfw:commentRss>http://splitchin.com/tech/2010/03/14/iphone%e3%82%a2%e3%83%97%e3%83%aa%e3%80%80uitableview%e3%82%92%e8%a9%a6%e3%81%99%e3%80%82/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

