<?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>iphoneアプリで稼げるのか &#187; ライブラリ</title>
	<atom:link href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/feed/" rel="self" type="application/rss+xml" />
	<link>http://iphone.longearth.net</link>
	<description></description>
	<lastBuildDate>Sun, 08 Aug 2010 21:05:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>【cocos2d入門】cocos2dのイベント</title>
		<link>http://iphone.longearth.net/2009/12/11/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88/</link>
		<comments>http://iphone.longearth.net/2009/12/11/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 00:00:00 +0000</pubDate>
		<dc:creator>daichi</dc:creator>
				<category><![CDATA[iphone開発]]></category>
		<category><![CDATA[cocos2d]]></category>
		<category><![CDATA[チュートリアル]]></category>
		<category><![CDATA[ライブラリ]]></category>
		<category><![CDATA[入門]]></category>

		<guid isPermaLink="false">http://iphone.longearth.net/?p=1653</guid>
		<description><![CDATA[
前回までのcocos2d入門。
【cocos2d入門】cocos2dのアニメーション &#124; iphoneアプリで稼げるのか

前回でcocos2dのアニメーションが終了。
今回はcocos2dでイベント処理します。
ここ [...]]]></description>
			<content:encoded><![CDATA[<p>
前回までのcocos2d入門。<br />
<a href="http://iphone.longearth.net/2009/12/09/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3/">【cocos2d入門】cocos2dのアニメーション | iphoneアプリで稼げるのか</a><br />
<br />
前回でcocos2dのアニメーションが終了。<br />
今回はcocos2dでイベント処理します。<br />
ここで使うcocos2dのバージョンは、前回同様cocos2d-0.9.0-alphaです。<br />
<span id="more-1653"></span><br />
<h3>Event</h3>
イベントとしてユーザからの応答を受け付ける処理の実装の仕方を見て行きます。<br />
<br />
イベント部分に関しては、ざっと見てみた限りUIKit系と同じでした。<br />
すなわち、タップと傾き(加速度)です。<br />
<h3>タップを検知</h3>
cocos2dでタップを検知するのはとても簡単です。<br />
検知してくれるのはCCLayerです。<br />
<br />
CCLayerクラスのプロパティisTouchEnabledにYESをセットすればOK。<br />
isTouchEnabledをYESにすると以下のコールバックメソッドが呼ばれるようになります。<br />
<ul>
	<li> &#8211; (BOOL)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event</li>
	<li> &#8211; (BOOL)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event</li>
	<li> &#8211; (BOOL)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event</li>
	<li> &#8211; (BOOL)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event</li>
</ul>
どこかで見たことがあるメソッド名です。そうです。<br />
UIViewのタップ関連メソッドとほとんど同じです。頭にccがついてるだけです。<br />
# 0.9.0だからついてるのかも。0.8系のものは未確認<br />
<br />
なので、特別な説明はここではしません。<br />
<h3>傾きを検知</h3>
傾き検知も簡単。<br />
CCLayerのisAccelerometerEnabledプロパティにYESをセットすれば検知開始。<br />
YESにすると以下のメソッドが呼ばれます。<br />
<br />
- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration<br />
<br />
これもUIKit系と同じですね。<br />
なので、イベントに関しては特別なことはあまりない感じでした。<br />
サンプルを載せておきます。# といってもcocos2dに含まれるソースのまんまです。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1653code2'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p16532"><td class="code" id="p1653code2"><pre class="objective-c" style="font-family:monospace;">#import &lt;UIKit/UIKit.h&gt;
#import &quot;HelloEvents.h&quot;
&nbsp;
// A simple 'define' used as a tag
enum {
	kTagSprite = 1,
};
&nbsp;
// HelloWorld implementation
@implementation HelloEvents
&nbsp;
// on &quot;init&quot; you need to initialize your instance
-(id) init
{
	// always call &quot;super&quot; init
	// Apple recommends to re-assign &quot;self&quot; with the &quot;super&quot; return value
	if( (self=[super init] )) {
&nbsp;
		// isTouchEnabled is an property of Layer (the super class).
		// When it is YES, then the touches will be enabled
		self.isTouchEnabled = YES;
&nbsp;
		// isTouchEnabled is property of Layer (the super class).
		// When it is YES, then the accelerometer will be enabled
		self.isAccelerometerEnabled = YES;
&nbsp;
		//
		// CCLabel
		//
&nbsp;
		// create and initialize a CCLabel
		CCLabel* label = [CCLabel labelWithString:@&quot;Hello Events&quot; fontName:@&quot;Marker Felt&quot; fontSize:64];
&nbsp;
		// ask director the the window size
		CGSize size = [[CCDirector sharedDirector] winSize];
&nbsp;
		// position the label on the center of the screen
		// &quot;ccp&quot; is a helper macro that creates a point. It means: &quot;CoCos Point&quot;
		label.position =  ccp( size.width /2 , size.height/2 );
&nbsp;
		// add the label as a child to this Layer
		[self addChild: label];
&nbsp;
		//
		// Sprite
		//
&nbsp;
		CCSprite *sprite = [CCSprite spriteWithFile:@&quot;grossini.png&quot;];
		sprite.position = ccp( 50, 50);
&nbsp;
		// z is the z-order. Greater values means on top of lower values.
		// Default z value is 0. So the sprite will be on top of the label.
		// Add the sprite with a tag, so we can later 'get' the sprite by this tag
		[self addChild:sprite z:1 tag:kTagSprite];		
	}
	return self;
}
&nbsp;
// on &quot;dealloc&quot; you need to release all your retained objects
- (void) dealloc
{
	// in case you have something to dealloc, do it in this method
	// in this particular example nothing needs to be released.
	// cocos2d will automatically release all the children (CCLabel)
&nbsp;
	// don't forget to call &quot;super dealloc&quot;
	[super dealloc];
}
&nbsp;
&nbsp;
// This callback will be called because 'isTouchesEnabled' is YES.
// Possible events:
//   * ccTouchesBegan
//   * ccTouchesMoved
//   * ccTouchesEnded
//   * cctouchesCancelled
- (BOOL)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
	UITouch *touch = [touches anyObject];
&nbsp;
	if( touch ) {
		CGPoint location = [touch locationInView: [touch view]];
&nbsp;
		// IMPORTANT:
		// The touches are always in &quot;portrait&quot; coordinates. You need to convert them to your current orientation
		CGPoint convertedPoint = [[CCDirector sharedDirector] convertToGL:location];
&nbsp;
		CCNode *sprite = [self getChildByTag:kTagSprite];
&nbsp;
		// we stop the all running actions
		[sprite stopAllActions];
&nbsp;
		// and we run a new action
		[sprite runAction: [CCMoveTo actionWithDuration:1 position:convertedPoint]];
&nbsp;
		// no other handlers will receive this event
		return kEventHandled;
	}
&nbsp;
	// we ignore the event. Other receivers will receive this event.
	return kEventIgnored;
}
&nbsp;
// This callback will be called because 'isAccelerometerEnabled' is YES.
- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration
{	
	CCNode *sprite = [self getChildByTag:kTagSprite];
&nbsp;
	// Convert the coordinates to 'landscape' coords
	// since they are always in 'portrait' coordinates
	CGPoint converted = ccp( (float)-acceleration.y, (float)acceleration.x);	
&nbsp;
	// update the rotation based on the z-rotation
	// the sprite will always be 'standing up'
	sprite.rotation = (float) CC_RADIANS_TO_DEGREES( atan2f( converted.x, converted.y) + M_PI );
&nbsp;
	// update the scale based on the length of the acceleration
	// the higher the acceleration, the higher the scale factor
	sprite.scale = 0.5f + sqrtf( (converted.x * converted.x) + (converted.y * converted.y) );
}
@end
&nbsp;
//
// Application Delegate implementation.
// Probably all your games will have a similar Application Delegate.
// For the moment it's not that important if you don't understand the following code.
//
@implementation AppController
&nbsp;
// window is a property. @synthesize will create the accesors methods
@synthesize window;
&nbsp;
// Application entry point
- (void) applicationDidFinishLaunching:(UIApplication*)application
{
&nbsp;
	// Try to use CADisplayLink director
	// if it fails (SDK &lt; 3.1) use Threaded director
	if( ! [CCDirector setDirectorType:CCDirectorTypeDisplayLink] )
		[CCDirector setDirectorType:CCDirectorTypeDefault];
&nbsp;
	// create an initilize the main UIWindow
	window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
&nbsp;
	// Enable Multiple Touches ? No
	[window setMultipleTouchEnabled:NO];
&nbsp;
	// Attach cocos2d to the window
	[[CCDirector sharedDirector] attachInWindow:window];
&nbsp;
	// before creating any layer, set the landscape mode
	[[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];
&nbsp;
	// Make the window visible
	[window makeKeyAndVisible];
&nbsp;
	// Create and initialize parent and empty Scene
	CCScene *scene = [CCScene node];
&nbsp;
	// Create and initialize our HelloEvents Layer
	CCLayer *layer = [HelloEvents node];
	// add our HelloEvents Layer as a child of the main scene
	[scene addChild:layer];
&nbsp;
	// Run!
	[[CCDirector sharedDirector] runWithScene: scene];
}
&nbsp;
- (void) dealloc
{
	[window release];
	[super dealloc];
}
&nbsp;
@end
&nbsp;
&nbsp;
//
// main entry point. Like any c or c++ program, the &quot;main&quot; is the entry point
//
int main(int argc, char *argv[]) {
	// it is safe to leave these lines as they are.
	NSAutoreleasePool *pool = [NSAutoreleasePool new];
	UIApplicationMain(argc, argv, nil, @&quot;AppController&quot;);
	[pool release];
	return 0;
}</pre></td></tr></table></div>

<br />
cocos2dはドキュメントも豊富で、サンプルコードのコメントも充実してるのでThree20と比べるとだいぶ助かります。<br />
<br />
と、今回までで、HelloWorld、アニメーション、イベントが終了したので、<br />
簡単なゲームアプリはこれだけでできてしまいそうです。<br />
五目並べとか、ソリティアとか、イベントを起点に動作が始まるゲームで、<br />
画面遷移を必要としないものなら。<br />
<br />
でもそれだと寂しいので、Sceneの切り替わりと、後はSprite(画像)の切り替え、メニューの表示、スレッド処理、当たり判定あたりをやれば、シューティングゲームまで作れそうな予感。<br />
<br />
まだまだやることは盛りだくさん。</p>

	<p>タグ: <a href="http://iphone.longearth.net/tag/cocos2d/" title="cocos2d" rel="tag nofollow">cocos2d</a>, <a href="http://iphone.longearth.net/tag/%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab/" title="チュートリアル" rel="tag nofollow">チュートリアル</a>, <a href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/" title="ライブラリ" rel="tag nofollow">ライブラリ</a>, <a href="http://iphone.longearth.net/tag/%e5%85%a5%e9%96%80/" title="入門" rel="tag nofollow">入門</a></p>

	<h4>関連する投稿</h4>
	<ul class="st-related-posts">
	<li><a href="http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91hello-world/" title="【cocos2d入門】Hello World! (2009 年 12 月 7 日)">【cocos2d入門】Hello World!</a> </li>
	<li><a href="http://iphone.longearth.net/2009/12/09/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3/" title="【cocos2d入門】cocos2dのアニメーション (2009 年 12 月 9 日)">【cocos2d入門】cocos2dのアニメーション</a> </li>
	<li><a href="http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e5%b0%8e%e5%85%a5/" title="【cocos2d入門】cocos2dの導入 (2009 年 12 月 7 日)">【cocos2d入門】cocos2dの導入</a> </li>
	<li><a href="http://iphone.longearth.net/2009/01/19/%e3%80%90uitableview%e3%80%91%e9%81%b8%e6%8a%9e%e8%a1%8c%e3%81%8b%e3%82%89%e5%88%a5%e7%94%bb%e9%9d%a2%e3%82%92%e5%91%bc%e3%81%b3%e5%87%ba%e3%81%99/" title="【UITableView】選択行から別画面を呼び出す (2009 年 1 月 19 日)">【UITableView】選択行から別画面を呼び出す</a> </li>
	<li><a href="http://iphone.longearth.net/2009/01/20/%e3%80%90uitableview%e3%80%91uitableview%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e8%a9%b3%e7%b4%b0%e7%94%bb%e9%9d%a2%e3%82%92%e4%bd%9c%e3%82%8b-1%e3%80%90uitableviewdatasource%e3%80%91/" title="【UITableView】UITableViewを使って詳細画面を作る-1【UITableViewDataSource】 (2009 年 1 月 20 日)">【UITableView】UITableViewを使って詳細画面を作る-1【UITableViewDataSource】</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://iphone.longearth.net/2009/12/11/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【cocos2d入門】cocos2dのアニメーション</title>
		<link>http://iphone.longearth.net/2009/12/09/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3/</link>
		<comments>http://iphone.longearth.net/2009/12/09/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 00:00:04 +0000</pubDate>
		<dc:creator>daichi</dc:creator>
				<category><![CDATA[iphone開発]]></category>
		<category><![CDATA[cocos2d]]></category>
		<category><![CDATA[チュートリアル]]></category>
		<category><![CDATA[ライブラリ]]></category>
		<category><![CDATA[入門]]></category>

		<guid isPermaLink="false">http://iphone.longearth.net/?p=1635</guid>
		<description><![CDATA[
前回までのcocos2d入門。
【cocos2d入門】Hello World! &#124; iphoneアプリで稼げるのか

前回でcocos2dのHelloWorldが終了。
今回はcocos2dでアニメーションします。
こ [...]]]></description>
			<content:encoded><![CDATA[<p>
前回までのcocos2d入門。<br />
<a href="http://iphone.longearth.net/2009/12/07/%E3%80%90cocos2d%E5%85%A5%E9%96%80%E3%80%91hello-world/">【cocos2d入門】Hello World! | iphoneアプリで稼げるのか</a><br />
<br />
前回でcocos2dのHelloWorldが終了。<br />
今回はcocos2dでアニメーションします。<br />
ここで使うcocos2dのバージョンは、前回同様cocos2d-0.9.0-alphaです。<br />
<span id="more-1635"></span><br />
<h3>Action</h3>
今回からプロジェクトの作成手順は書きません。<br />
前回の記事を参考にしてください。<br />
本当は新たにターゲットを作ろうと思いましたが、面倒なので前回のHelloWorldターゲットに処理を追加することにします。<br />
ActionはLabelやSpriteに対して有効なので、今回はLayerクラスの中での処理がメインになります。<br />
<br />
cocos2dでアニメーションはActionと呼ばれます。Actionは移動、回転、拡大といったベーシックなアニメーションからそれらのリバース、繰り返し、同時実行、順次実行、イージング、メソッド実行等の複雑な操作までが簡単に行えるように作られています。<br />
<br />
<h3>ベーシックアニメーション</h3>
<h4>移動</h4>
移動はCCMoveBy, CCMoveToクラスで指定します。<br />
Layerクラスのinitメソッド内で,CCMoveByアニメーションを記述してみます。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code16'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163516"><td class="code" id="p1635code16"><pre class="objective-c" style="font-family:monospace;">-(id) init
{
	if( (self=[super init] )) {
&nbsp;
		CCLabel* label = [CCLabel labelWithString:@&quot;Hello World&quot; fontName:@&quot;Marker Felt&quot; fontSize:64];
		CGSize size = [[CCDirector sharedDirector] winSize];
		label.position =  ccp( size.width /2 , size.height/2 );
		[self addChild: label];
&nbsp;
		id moveBy = [CCMoveBy actionWithDuration:2.0f position:ccp(10,0)];
		[label runAction:moveBy];
        }
        return self;
}</pre></td></tr></table></div>

<br />
<br />
アクションはLayerへaddChildした後に記述すれば問題ありません。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code17'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163517"><td class="code" id="p1635code17"><pre class="objective-c" style="font-family:monospace;">	id moveto = [CCMoveBy actionWithDuration:2.0f position:ccp(10,0)];</pre></td></tr></table></div>

<br />
上の部分でactionを生成しています。<br />
actionWithDurationで実行する時間を、positionで移動する場所を指定しています。この場合、X方向に+10の場所まで、２秒かけて移動するアニメーションになります。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code18'); return false;">View Code</a> OBJECTIVIE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163518"><td class="code" id="p1635code18"><pre class="objectivie-c" style="font-family:monospace;">	[label runAction:moveBy];</pre></td></tr></table></div>

<br />
上のようにLabelやSpriteのrunActionメソッドにactionインスタンスを渡すだけです。簡単すぎます。アニメーションが！<br />
<br />
これをUIKit系でやろうとするとこんな形になります。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code19'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163519"><td class="code" id="p1635code19"><pre class="objective-c" style="font-family:monospace;">[UIView beginAnimation:nil context:nil];
[UIView setAnimationDuration:2.0f];
frame = CGRectMake(frame.origin.x + 10,frame.origin.y, frame.size.width, frame.size.height);
[UIView commitAnimation];</pre></td></tr></table></div>

<br />
これはまだ移動のみのアニメーションなのでよいですが、このアニメーション終了後に別のアニメーションを、さらに別のを、と続けていくと、だいぶ面倒になってきます。<br />
が、cocos2dを使うとさくっとできます。すばらしい！<br />
<br />
ちなみに、Actionクラスで最後にByとつくものは相対的なAction、Toとつくものは絶対的なActionになります。上の例でCCMoveToと指定すると(10, 0)の位置にLabelが移動する感じです。<br />
<h4>回転</h4>
回転はCCRotateBy,CCRotateToクラスです。以降はActionクラス関連のみのソースを書くことにします。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code20'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163520"><td class="code" id="p1635code20"><pre class="objective-c" style="font-family:monospace;">id rotateBy = [CCRotateBy actionWithDuration:2.0f angle:180*2];
[label runAction:rotateBy];</pre></td></tr></table></div>

<br />
これは２秒かけて一回転するアニメーション。１秒で半回転します。引数なども直感で分かると思います。<br />
<h4>拡大</h4>
拡大はCCScaleBy, CCScaleToクラスです。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code21'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163521"><td class="code" id="p1635code21"><pre class="objective-c" style="font-family:monospace;">id scaleBy = [CCScaleBy actionWithDuration:1.0f scale:2.0f];
[label runAction:scaleBy];</pre></td></tr></table></div>

<br />
これは１秒間で大きさを２倍にするアニメーション。それ以上の説明はいりませんね。<br />
<h4>ジャンプ</h4>
ジャンプはCCJumpBy, CCJumpToクラス。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code22'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163522"><td class="code" id="p1635code22"><pre class="objective-c" style="font-family:monospace;">id jumpBy = [CCJumpBy actionWithDuration:4.0f position:ccp(100,0) height:200 jumps:4];
[label runAction:jumpBy];</pre></td></tr></table></div>

<br />
これは４秒間かけて、高さ200の位置までのジャンプを４回繰り返し、X+100の位置まで移動するアニメーション。多少ごちゃごちゃしますが、UIKitを思えばものすごくシンプルです。<br />
<br />
他のベーシックなアニメーションの詳細はこちらに。<br />
<a href="http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:actions">prog_guide:actions [cocos2d for iPhone]</a><br />
<h3>リバース</h3>
リバースとは、アニメーションの逆再生のイメージです。例えば、<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code23'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163523"><td class="code" id="p1635code23"><pre class="objective-c" style="font-family:monospace;">id scaleBy = [CCScaleBy actionWithDuration:1.0f scale:2.0f];
id reverse = [scaleBy reverse];
[label runAction:reverse];</pre></td></tr></table></div>

<br />
などとすると、最初に2倍に拡大された状態から、１秒かけて等倍まで縮小されるアニメーションになります。<br />
actionインスタンスのreverseメソッドでリバースActionが生成できます。<br />
<h3>繰り返し</h3>
繰り返しはCCRepeat, CCRepeatForeverクラスです。ベーシックアニメーションに対して繰り返し処理をさせることができます。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code24'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163524"><td class="code" id="p1635code24"><pre class="objective-c" style="font-family:monospace;">id scaleBy = [CCScaleBy actionWithDuration:1.0f scale:2.0f];
id repeat = [CCRepeat actionWithAction:scaleBy times:2];
[label runAction:repeat];</pre></td></tr></table></div>

<br />
上の例では、拡大アニメーションを２回繰り返します。<br />
<h3>同時実行</h3>
同時実行はCCSpawnクラスです。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code25'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163525"><td class="code" id="p1635code25"><pre class="objective-c" style="font-family:monospace;">id rotateAction = [CCRotateBy actionWithDuration:4 angle:180*4];
id jumpAction = [CCJumpBy actionWithDuration:4 position:ccp(size.width,0) height:100 jumps:4];
id spawn = [CCSpawn actions:rotateAction, jumpAction, nil];
[label runWithAction:spawn];</pre></td></tr></table></div>

<br />
CCSpawnのactionsメソッドにactionクラスを列挙すれば、それらが同時に実行されます。この例では回転とジャンプが同時に行われます。<br />
これはcocos2dのサンプルコードにもあるので、動きを見てみてください。<br />
ジャンプを４回するのですが、１回ジャンプするごとに半回転していきます。<br />
<h3>順次実行</h3>
順次実行はCCSequenceクラスです。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code26'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163526"><td class="code" id="p1635code26"><pre class="objective-c" style="font-family:monospace;">id spawn = [CCSpawn actions:rotateAction, jumpAction, nil];
id backwards = [spawn reverse];
id sequence = [CCSequence actions: spawn, backwards, nil];</pre></td></tr></table></div>

<br />
同時実行のところで作ったジャンプ＆回転アニメーションとそのリバースアニメーションを順番に実行します。CCSequenceのactionsメソッドにActionクラスを指定すると、その順に実行されます。<br />
このあたりのことはこちらに詳細が。<br />
<a href="http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:actions_composition">prog_guide:actions_composition [cocos2d for iPhone]</a><br />
<h3>イージング</h3>
イージングはたくさんあるので、CCEaseInだけ紹介しておきます。イージングでは移動する速度を変化させてアニメーションできます。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code27'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163527"><td class="code" id="p1635code27"><pre class="objective-c" style="font-family:monospace;">id move = [CCMoveBy actionWithDuration:1.0f position:ccp(100,0)];
id ease = [CCEaseBackIn actionWithAction:move];</pre></td></tr></table></div>

<br />
口では説明しづらいので、実際に試してみてください。<br />
速度の変化のグラフはここにまとまっています。<br />
<a href="http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:actions_ease">prog_guide:actions_ease [cocos2d for iPhone]</a><br />
<h3>メソッド実行</h3>
メソッド実行はCCCallFuncクラスです。例えばこのようにすると、<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1635code28'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p163528"><td class="code" id="p1635code28"><pre class="objective-c" style="font-family:monospace;">                id move = [CCMoveBy actionWithDuration:1.0f position:ccp(100,0)];
		id fanc = [CCCallFunc actionWithTarget:self selector:@selector(fanc)];
		id seq = [CCSequence actions:move, fanc, nil];
		[label runAction:seq];</pre></td></tr></table></div>

<br />
moveが実行された後で、fancメソッドが実行されます。<br />
これも詳細はこちらで。<br />
<a href="http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:actions_special">prog_guide:actions_special [cocos2d for iPhone]</a><br />
<br />
アニメーションはこの辺で。<br />
他にもアニメーションはあるので、詳しくはAPIを確認してみてください。<br />
<br />
# ほんとはアニメーション動画も用意したかったですが、心が折れました。<br />
<br />
次はイベントやります。<br />
</p>

	<p>タグ: <a href="http://iphone.longearth.net/tag/cocos2d/" title="cocos2d" rel="tag nofollow">cocos2d</a>, <a href="http://iphone.longearth.net/tag/%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab/" title="チュートリアル" rel="tag nofollow">チュートリアル</a>, <a href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/" title="ライブラリ" rel="tag nofollow">ライブラリ</a>, <a href="http://iphone.longearth.net/tag/%e5%85%a5%e9%96%80/" title="入門" rel="tag nofollow">入門</a></p>

	<h4>関連する投稿</h4>
	<ul class="st-related-posts">
	<li><a href="http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91hello-world/" title="【cocos2d入門】Hello World! (2009 年 12 月 7 日)">【cocos2d入門】Hello World!</a> </li>
	<li><a href="http://iphone.longearth.net/2009/12/11/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88/" title="【cocos2d入門】cocos2dのイベント (2009 年 12 月 11 日)">【cocos2d入門】cocos2dのイベント</a> </li>
	<li><a href="http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e5%b0%8e%e5%85%a5/" title="【cocos2d入門】cocos2dの導入 (2009 年 12 月 7 日)">【cocos2d入門】cocos2dの導入</a> </li>
	<li><a href="http://iphone.longearth.net/2009/01/19/%e3%80%90uitableview%e3%80%91%e9%81%b8%e6%8a%9e%e8%a1%8c%e3%81%8b%e3%82%89%e5%88%a5%e7%94%bb%e9%9d%a2%e3%82%92%e5%91%bc%e3%81%b3%e5%87%ba%e3%81%99/" title="【UITableView】選択行から別画面を呼び出す (2009 年 1 月 19 日)">【UITableView】選択行から別画面を呼び出す</a> </li>
	<li><a href="http://iphone.longearth.net/2009/01/20/%e3%80%90uitableview%e3%80%91uitableview%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e8%a9%b3%e7%b4%b0%e7%94%bb%e9%9d%a2%e3%82%92%e4%bd%9c%e3%82%8b-1%e3%80%90uitableviewdatasource%e3%80%91/" title="【UITableView】UITableViewを使って詳細画面を作る-1【UITableViewDataSource】 (2009 年 1 月 20 日)">【UITableView】UITableViewを使って詳細画面を作る-1【UITableViewDataSource】</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://iphone.longearth.net/2009/12/09/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>【cocos2d入門】Hello World!</title>
		<link>http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91hello-world/</link>
		<comments>http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91hello-world/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 13:32:38 +0000</pubDate>
		<dc:creator>daichi</dc:creator>
				<category><![CDATA[iphone開発]]></category>
		<category><![CDATA[cocos2d]]></category>
		<category><![CDATA[チュートリアル]]></category>
		<category><![CDATA[ライブラリ]]></category>
		<category><![CDATA[入門]]></category>

		<guid isPermaLink="false">http://iphone.longearth.net/?p=1598</guid>
		<description><![CDATA[
前回までのcocos2d入門。
【cocos2d入門】cocos2dの導入 &#124; iphoneアプリで稼げるのか

前回でcocos2dの導入が終了。
今回はcocos2dでHello World!します。
ここで使うc [...]]]></description>
			<content:encoded><![CDATA[<p>
前回までのcocos2d入門。<br />
<a href="http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e5%b0%8e%e5%85%a5/">【cocos2d入門】cocos2dの導入 | iphoneアプリで稼げるのか</a><br />
<br />
前回でcocos2dの導入が終了。<br />
今回はcocos2dでHello World!します。<br />
ここで使うcocos2dのバージョンは、cocos2d-0.9.0-alphaです。<br />
<br />
<span id="more-1598"></span><br />
<h3>プロジェクト作成</h3>
新規にプロジェクトを作成します。<br />
前回の導入で3つのcocos2dテンプレートが作成されています。<br />
それぞれ通常のアプリ、Box2dを使うアプリ、Chipmunkを使うアプリのようです。<br />
(多分Box2dとChipmunkは物理演算用アプリかな。)<br />
ここでは通常のcocos2d-0.9.0-alpha Applicationを選択してプロジェクトを作成します。<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/7ddf6c7b33e001f2220a729a7bbe0f32.png"><img class="alignleft size-medium wp-image-1599" title="プロジェクト作成" src="http://iphone.longearth.net/wp-content/uploads/2009/12/7ddf6c7b33e001f2220a729a7bbe0f32-300x230.png" alt="プロジェクト作成" width="300" height="230" /></a><br />
<br />
名前はcocos2dTestにしました。<br />
<h3>早速ビルド</h3>
ビルドすると早々にHello World!が表示されるではありませんか。<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/890ac4b5e158568870c80085fdc24370.png"><img class="alignleft size-medium wp-image-1602" title="Hello Worldダメ" src="http://iphone.longearth.net/wp-content/uploads/2009/12/890ac4b5e158568870c80085fdc24370-300x161.png" alt="Hello Worldダメ" width="300" height="161" /></a><br />
<br />
これは反則です。<br />
なので1から作ることにします。<br />
<h3>Hellow World用ターゲットを作る</h3>
せっかくなので、cocos2dのソースコードのようにターゲットを指定して、複数のチュートリアルアプリを作っていこうと思います。<br />
<br />
グループとファイル→ターゲットを右クリック→追加→新規ターゲット。<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/58412bd0f6f2e40d0f6581bf79ce13a4.png"><img class="alignleft size-medium wp-image-1603" title="新規ターゲット" src="http://iphone.longearth.net/wp-content/uploads/2009/12/58412bd0f6f2e40d0f6581bf79ce13a4-300x239.png" alt="新規ターゲット" width="300" height="239" /></a><br />
<br />
Applicationを選択。<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/e1de0695805a8e1b7fcc26dc5d396188.png"><img class="alignleft size-medium wp-image-1604" title="Application" src="http://iphone.longearth.net/wp-content/uploads/2009/12/e1de0695805a8e1b7fcc26dc5d396188-300x230.png" alt="Application" width="300" height="230" /></a><br />
<br />
ターゲット名はHelloWorldで。<br />
<br />
続いてターゲットの情報画面が開くので、直接依存関係にcocos2d Libraryを追加。<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/075a2330b747911e4d43a6454332984e.png"><img class="alignleft size-medium wp-image-1607" title="HelloWorldターゲット" src="http://iphone.longearth.net/wp-content/uploads/2009/12/075a2330b747911e4d43a6454332984e-270x300.png" alt="HelloWorldターゲット" width="270" height="300" /></a><br />
<br />
次に、グループとファイル→Frameworks→右クリック→情報をみる<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/8d81b5639b858d3c1377e64e384f271a.png"><img class="alignleft size-medium wp-image-1610" title="Frameworkをターゲットに追加" src="http://iphone.longearth.net/wp-content/uploads/2009/12/8d81b5639b858d3c1377e64e384f271a-210x300.png" alt="Frameworkをターゲットに追加" width="210" height="300" /></a><br />
<br />
HelloWorldターゲットにチェックを入れる。<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/c9b1c5da2c4422cf6b39dddd552d0401.png"><img class="alignleft size-medium wp-image-1611" title="HelloWorldターゲットにチェックを入れる" src="http://iphone.longearth.net/wp-content/uploads/2009/12/c9b1c5da2c4422cf6b39dddd552d0401-226x300.png" alt="HelloWorldターゲットにチェックを入れる" width="226" height="300" /></a><br />
<br />
Resourceも同様に。<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/3e54de538b34f36a6104953c1615845a.png"><img class="alignleft size-medium wp-image-1609" title="Resourceをターゲットに追加" src="http://iphone.longearth.net/wp-content/uploads/2009/12/3e54de538b34f36a6104953c1615845a-223x300.png" alt="Resourceをターゲットに追加" width="223" height="300" /></a><br />
<br />
それからProductsにあるcocos2d libraries.aのターゲットにもHelloWorldを追加。<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/04231ba54e9e2acead67010ce8abe536.png"><img class="alignleft size-medium wp-image-1616" title="cocos2d libraries.aをHelloWorldへ" src="http://iphone.longearth.net/wp-content/uploads/2009/12/04231ba54e9e2acead67010ce8abe536-250x300.png" alt="cocos2d libraries.aをHelloWorldへ" width="250" height="300" /></a><br />
<br />
最後にClassesの中にHelloWorldグループを作っておきます。<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/5e3778a49d3d16247cf77411a315c8e1.png"><img class="alignleft size-medium wp-image-1613" title="HelloWorldグループ" src="http://iphone.longearth.net/wp-content/uploads/2009/12/5e3778a49d3d16247cf77411a315c8e1-300x262.png" alt="HelloWorldグループ" width="300" height="262" /></a><br />
HelloWorld用ファイルはここに入れることにします。<br />
<h3>いよいよHelloWorld!</h3>
それではHelloWorldします。<br />
<br />
HelloWorldApplicationクラスを作成します。<br />
ターゲットはHelloWorldのみを選択！<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/411975d1d5390933e2fcf0e8fdf465f8.png"><img class="alignleft size-medium wp-image-1614" title="HelloWorldApplication" src="http://iphone.longearth.net/wp-content/uploads/2009/12/411975d1d5390933e2fcf0e8fdf465f8-300x230.png" alt="HelloWorldApplication" width="300" height="230" /></a><br />
<br />
このHelloWorldApplication.hと.mに今回のHelloWorldアプリの全てを書くことにしますが、その前に、<br />
<h3>Cocos2dの考え方</h3>
<a href="http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:basic_concepts">prog_guide:basic_concepts [cocos2d for iPhone]</a><br />
<br />
ここにcocos2dの概要が書いてありますが、cocos2dの世界では大きく<br />
<ul>
	<li>Scenes</li>
	<li>Director</li>
	<li>Layers</li>
	<li>Sprites</li>
</ul>
の４つが主要な登場人物らしい。説明の中ではLabelも出てきてる。<br />
<br />
ざっくりまとめてしまうと、<br />
Directorが複数のSceneを管理し、Sceneが複数のLayerを管理し、Layerが複数のSprite、Labelを管理する。ということらしい。<br />
<br />
Directorはシングルトンでアプリに１つだけ存在する。<br />
Sceneはオープニングシーンやメニューシーン、１面、２面などを表す。<br />
<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/scenes.png"><img class="alignleft size-medium wp-image-1621" title="scenes" src="http://iphone.longearth.net/wp-content/uploads/2009/12/scenes-300x66.png" alt="scenes" width="300" height="66" /></a><br />
<br />
LayerはSceneの中の背景レイヤやメニューレイヤ、アニメーションレイヤなどを表す。<br />
<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/layers.png"><img class="alignleft size-medium wp-image-1623" title="layers" src="http://iphone.longearth.net/wp-content/uploads/2009/12/layers-300x139.png" alt="layers" width="300" height="139" /></a><br />
<br />
Spriteはレイヤの中の山の画像、雲の画像を。<br />
Labelはレイヤの中の文字。<br />
<br />
という感じ。<br />
<br />
なのでHelloWorldではHelloWorldを出すSceneとLayer、HelloWorldの文字を表示するLabelが必要ということになる。<br />
<h3>今度こそHelloWorld</h3>
というわけでHelloWorldしましょう。<br />
<br />
HelloWorldApplication.h<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1598code34'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p159834"><td class="code" id="p1598code34"><pre class="objective-c" style="font-family:monospace;">#import
#import &quot;cocos2d.h&quot;
&nbsp;
@interface HelloWorldApplication : NSObject  {
	UIWindow *window;
}
&nbsp;
@property (nonatomic, retain) UIWindow *window;
&nbsp;
@end
&nbsp;
// HelloWorld Layer
@interface HelloWorldLayer : CCLayer
{
}
&nbsp;
// returns a Scene that contains the HelloWorld as the only child
+(id) scene;
&nbsp;
@end</pre></td></tr></table></div>

<br />
<br />
HelloWorldApplication.m<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1598code35'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p159835"><td class="code" id="p1598code35"><pre class="objective-c" style="font-family:monospace;">#import &quot;HelloWorldApplication.h&quot;
&nbsp;
@implementation HelloWorldApplication
&nbsp;
@synthesize window;
&nbsp;
- (void) applicationDidFinishLaunching:(UIApplication*)application
{
	// Init the window
	window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
&nbsp;
	// create an openGL view inside a window
	[[CCDirector sharedDirector] attachInView:window];
	[window makeKeyAndVisible];		
&nbsp;
	[[CCDirector sharedDirector] runWithScene: [HelloWorldLayer scene]];
}
&nbsp;
- (void)dealloc {
	[[CCDirector sharedDirector] release];
	[window release];
	[super dealloc];
}
&nbsp;
@end
&nbsp;
@implementation HelloWorldLayer
&nbsp;
+(id) scene
{
	// 'scene' is an autorelease object.
	CCScene *scene = [CCScene node];
&nbsp;
	// 'layer' is an autorelease object.
	HelloWorldLayer *layer = [HelloWorldLayer node];
&nbsp;
	// add layer as a child to scene
	[scene addChild: layer];
&nbsp;
	// return the scene
	return scene;
}
&nbsp;
// on &quot;init&quot; you need to initialize your instance
-(id) init
{
	// always call &quot;super&quot; init
	// Apple recommends to re-assign &quot;self&quot; with the &quot;super&quot; return value
	if( (self=[super init] )) {
&nbsp;
		// create and initialize a Label
		CCLabel* label = [CCLabel labelWithString:@&quot;Hello World&quot; fontName:@&quot;Marker Felt&quot; fontSize:64];
&nbsp;
		// ask director the the window size
		CGSize size = [[CCDirector sharedDirector] winSize];
&nbsp;
		// position the label on the center of the screen
		label.position =  ccp( size.width /2 , size.height/2 );
&nbsp;
		// add the label as a child to this Layer
		[self addChild: label];
	}
	return self;
}
&nbsp;
// on &quot;dealloc&quot; you need to release all your retained objects
- (void) dealloc
{
	// in case you have something to dealloc, do it in this method
	// in this particular example nothing needs to be released.
	// cocos2d will automatically release all the children (Label)
&nbsp;
	// don't forget to call &quot;super dealloc&quot;
	[super dealloc];
}
&nbsp;
@end
&nbsp;
int main(int argc, char *argv[]) {
	NSAutoreleasePool *pool = [NSAutoreleasePool new];
	int retVal = UIApplicationMain(argc, argv, nil, @&quot;HelloWorldApplication&quot;);
	[pool release];
	return retVal;
}</pre></td></tr></table></div>

<br />
<br />
結局、コピペしたのはここだけの話ですが、重要なポイントをピックアップしてみます。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1598code36'); return false;">View Code</a> OBJECTIVIE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p159836"><td class="code" id="p1598code36"><pre class="objectivie-c" style="font-family:monospace;">	[[CCDirector sharedDirector] runWithScene: [HelloWorldLayer scene]];</pre></td></tr></table></div>

<br />
<br />
cocos2dのディレクターはCCDirectorクラスです。シングルトンなのでクラスメソッドのsharedDirectorで呼び出すようになってます。<br />
<br />
また、DirectorがSceneを開始するのは、runWithSceneメソッド。<br />
引数にSceneを渡してあげればSceneが開始されます。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1598code37'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p159837"><td class="code" id="p1598code37"><pre class="objective-c" style="font-family:monospace;">+(id) scene
{
	// 'scene' is an autorelease object.
	CCScene *scene = [CCScene node];
&nbsp;
	// 'layer' is an autorelease object.
	HelloWorldLayer *layer = [HelloWorldLayer node];
&nbsp;
	// add layer as a child to scene
	[scene addChild: layer];
&nbsp;
	// return the scene
	return scene;
}</pre></td></tr></table></div>

<br />
<br />
続いて、HelloWorldLayerのsceneメソッド。<br />
cocos2dのSceneはCCSceneクラスが、LayerはCCLayerクラスが担当します。<br />
ここでは、Sceneの管理するLayerを登録しています。<br />
これはおそらくLayerが１つだからこういう作りにしてるのだと思いますが、LayerクラスのクラスメソッドでSceneを生成して、Layerも生成して、SceneにLayerをaddChildして登録してます。<br />
Sceneの生成は<br />
[CCScene node]<br />
で。<br />
Layerの生成は<br />
[CCLayer node]<br />
でできます。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1598code38'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p159838"><td class="code" id="p1598code38"><pre class="objective-c" style="font-family:monospace;">-(id) init
{
	// always call &quot;super&quot; init
	// Apple recommends to re-assign &quot;self&quot; with the &quot;super&quot; return value
	if( (self=[super init] )) {
&nbsp;
		// create and initialize a Label
		CCLabel* label = [CCLabel labelWithString:@&quot;Hello World&quot; fontName:@&quot;Marker Felt&quot; fontSize:64];
&nbsp;
		// ask director the the window size
		CGSize size = [[CCDirector sharedDirector] winSize];
&nbsp;
		// position the label on the center of the screen
		label.position =  ccp( size.width /2 , size.height/2 );
&nbsp;
		// add the label as a child to this Layer
		[self addChild: label];
	}
	return self;
}</pre></td></tr></table></div>

<br />
<br />
最後にLayerクラスのinitメソッド。<br />
ここでは、Layerが管理（表示）するLabelを登録してます。<br />
LabelはCCLabelが担当します。<br />
この部分はUIKit系と同じ感覚でできそうです。<br />
UIViewを作ってframeを定義して、viewにaddSubviewする感覚で、CCLabelを作って、positionを定義して、layerにaddChildすると。<br />
<br />
ccpはcocos2dの便利マクロらしく、CGPointをMakeしてくれるようです。<br />
labelのpositionはUIViewでいうcenterと同じっぽい。<br />
<br />
完成はこちら。<br />
<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/c0366ffc26a1eefa1b518736b489f97c.png"><img src="http://iphone.longearth.net/wp-content/uploads/2009/12/c0366ffc26a1eefa1b518736b489f97c-161x300.png" alt="HelloWorld!" title="HelloWorld!" width="161" height="300" class="alignleft size-medium wp-image-1632" /></a><br />
<br />
<h3>まとめ</h3>
というわけで、駆け足で見てきましたが、<br />
ポイントは、<br />
<ul>
	<li>DirectorがSceneを、SceneがLayerを、LayerがLabel、Spriteを管理する</li>
	<li>DirectoreがSceneを実行するのは[CCDirector sharedDirector] runWithScene:scene]</li>
	<li>SceneがLayerを登録するのは[scene addChild: layer]</li>
	<li>LayerがLabel、Spriteを登録するのは[layer addChild:label]</li>
	<li>Sceneの生成は[CCScene node]</li>
	<li>Layerの生成は[CCLayer node]</li>
</ul>
これだけおさえておけば、最低１シーンの画面表示はできるでしょう。きっと。<br />
<br />
さて、次回はActionについてやります。</p>

	<p>タグ: <a href="http://iphone.longearth.net/tag/cocos2d/" title="cocos2d" rel="tag nofollow">cocos2d</a>, <a href="http://iphone.longearth.net/tag/%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab/" title="チュートリアル" rel="tag nofollow">チュートリアル</a>, <a href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/" title="ライブラリ" rel="tag nofollow">ライブラリ</a>, <a href="http://iphone.longearth.net/tag/%e5%85%a5%e9%96%80/" title="入門" rel="tag nofollow">入門</a></p>

	<h4>関連する投稿</h4>
	<ul class="st-related-posts">
	<li><a href="http://iphone.longearth.net/2009/12/11/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88/" title="【cocos2d入門】cocos2dのイベント (2009 年 12 月 11 日)">【cocos2d入門】cocos2dのイベント</a> </li>
	<li><a href="http://iphone.longearth.net/2009/12/09/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3/" title="【cocos2d入門】cocos2dのアニメーション (2009 年 12 月 9 日)">【cocos2d入門】cocos2dのアニメーション</a> </li>
	<li><a href="http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e5%b0%8e%e5%85%a5/" title="【cocos2d入門】cocos2dの導入 (2009 年 12 月 7 日)">【cocos2d入門】cocos2dの導入</a> </li>
	<li><a href="http://iphone.longearth.net/2009/01/19/%e3%80%90uitableview%e3%80%91%e9%81%b8%e6%8a%9e%e8%a1%8c%e3%81%8b%e3%82%89%e5%88%a5%e7%94%bb%e9%9d%a2%e3%82%92%e5%91%bc%e3%81%b3%e5%87%ba%e3%81%99/" title="【UITableView】選択行から別画面を呼び出す (2009 年 1 月 19 日)">【UITableView】選択行から別画面を呼び出す</a> </li>
	<li><a href="http://iphone.longearth.net/2009/01/20/%e3%80%90uitableview%e3%80%91uitableview%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e8%a9%b3%e7%b4%b0%e7%94%bb%e9%9d%a2%e3%82%92%e4%bd%9c%e3%82%8b-1%e3%80%90uitableviewdatasource%e3%80%91/" title="【UITableView】UITableViewを使って詳細画面を作る-1【UITableViewDataSource】 (2009 年 1 月 20 日)">【UITableView】UITableViewを使って詳細画面を作る-1【UITableViewDataSource】</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【cocos2d入門】cocos2dの導入</title>
		<link>http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e5%b0%8e%e5%85%a5/</link>
		<comments>http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e5%b0%8e%e5%85%a5/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 00:00:12 +0000</pubDate>
		<dc:creator>daichi</dc:creator>
				<category><![CDATA[iphone開発]]></category>
		<category><![CDATA[cocos2d]]></category>
		<category><![CDATA[チュートリアル]]></category>
		<category><![CDATA[ライブラリ]]></category>

		<guid isPermaLink="false">http://iphone.longearth.net/?p=1575</guid>
		<description><![CDATA[
今更な感はありますが、cocos2dの勉強を始めました。

cocos2dはiPhoneアプリ用の2Dゲーム作成を手助けしてくれるライブラリです。

cocos2dの勉強記録をこれからブログに残していこうと思います。
 [...]]]></description>
			<content:encoded><![CDATA[<p>
今更な感はありますが、cocos2dの勉強を始めました。<br />
<br />
cocos2dはiPhoneアプリ用の2Dゲーム作成を手助けしてくれるライブラリです。<br />
<br />
cocos2dの勉強記録をこれからブログに残していこうと思います。<br />
今度こそちゃんと続けたい。<br />
# three20はぜんぜん書いてない。。。需要あるなら書こうと思います。<br />
<br />
勉強は主にここを参考にしてます。<br />
<a href="http://www.cocos2d-iphone.org/wiki/doku.php/start">start [cocos2d for iPhone]</a><br />
<br />
今回は初回なのでcocos2dの導入部分です。<br />
<span id="more-1575"></span><br />
<h3>cocos2dの導入</h3>
まずはcocos2dのソースを取得します。以下のリンク先から最新のものをローカルに保存。<br />
<a href="http://code.google.com/p/cocos2d-iphone/">cocos2d-iphone &#8211; Project Hosting on Google Code</a><br />
<br />
ここではcocos2d-iphone-0.9.0-alpha.tar.gzを使うことにします。<br />
ローカルに保存したら迷わず展開してください。<br />
展開した上のディレクトリを便宜上COCOS_HOMEと呼ぶことにします。<br />
<br />
次にCOCOS_HOME直下にあるXcodeプロジェクトを開く。<br />
cocos2dはサンプルソースも豊富です。サンプル達はそれぞれXcodeでターゲットが用意されていて、そいつを指定すると実行することができます。<br />
<br />
その操作をしやすくするために、Xcodeのツールバーをカスタマイズします。<br />
メニュー→表示→ツールバーをカスタマイズ<br />
からアクティブターゲットをツールバーへドラッグ&#038;ドロップ。<br />
<br />
同様にアクティブな実行可能ファイルもツールバーへ。<br />
<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/5a9579a81479c92d2c9018b1d67cba8f.png"><img src="http://iphone.longearth.net/wp-content/uploads/2009/12/5a9579a81479c92d2c9018b1d67cba8f-300x41.png" alt="ツールバー" title="ツールバー" width="300" height="41" class="alignleft size-medium wp-image-1581" /></a><br />
<br />
先ほど追加したアクティブターゲットのプルダウンから適当にターゲットを指定して実行して、それぞれのサンプルの動きを見てみると面白いです。たくさんのターゲットがあります。<br />
<br />
ターゲットにどのソースが使われているのかは<br />
グループとファイル→ターゲット→「ターゲット名」→ソースをコンパイル<br />
の中を見れば分かります。サンプルの動きからこれを取り入れたい！というのがあればソースを参考にするとよいと思います。<br />
<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/ee17e71b79cb25f482d184ffaad4903c.png"><img src="http://iphone.longearth.net/wp-content/uploads/2009/12/ee17e71b79cb25f482d184ffaad4903c-183x300.png" alt="ターゲット" title="ターゲット" width="183" height="300" class="alignleft size-medium wp-image-1583" /></a><br />
<br />
<br />
<h3>cocos2dテンプレートの導入</h3>
cocos2dを使ったプロジェクトを作成する時に、毎回ライブラリの設定をするのは面倒なので、xcodeでcocos2dを利用する準備が整ったプロジェクトをテンプレートとして利用できるようにします。<br />
<br />
以下のコマンドを実行。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1575code40'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p157540"><td class="code" id="p1575code40"><pre class="shell" style="font-family:monospace;">$ cd [COCOS_HOME]
$ ./install_template.sh</pre></td></tr></table></div>

<br />
<br />
<br />
これでcocos2d用のプロジェクトテンプレートが作成されます。<br />
新しくcocos2dアプリケーションを作成する場合は、cococs2dのテンプレートを選択して作成するようにしましょう。<br />
<br />
<h3>cocos2dのドキュメント設定</h3>
cocos2dはソースコードも大量なので、何か調べる時にいちいちソースを見ていくのはしんどいです。なので、doxygenを使ってドキュメントを生成して、何か参照したい場合はドキュメントを見れるようにしておきます。<br />
<br />
doxygenは各自インストールしてください。<br />
<br />
アクティブターゲットで「cocos2d-documantation」を指定して実行。<br />
<br />
~/Library/Developer/Shared/Documentation/DocSets/ 以下に com.sapusmedia.Cocos2d.docset<br />
が出来ているので、ここからドキュメントが見れるようになります。<br />
<br />
設定の詳細は以下が詳しいです。<br />
<a href="http://www.syuhari.jp/blog/archives/1775">[iPhone] cocos2d 入門２ – ドキュメントを設定する | Sun Limited Mt.</a><br />
<br />
導入は以上です。<br />
<br />
今後はHello World、Action、Event、あたりを書く予定。<br />
その後は、Scenes、Director、Layers、Spritesを攻めたい。<br />
<br />
<h4>他の参考した記事</h4>
<a href="http://www.syuhari.jp/blog/archives/1768">[iPhone] cocos2d 入門1 – テンプレートを設定 | Sun Limited Mt.</a><br />
<a href="http://www.cocos2d-iphone.org/wiki/doku.php/resources:templates">resources:templates [cocos2d for iPhone]</a></p>

	<p>タグ: <a href="http://iphone.longearth.net/tag/cocos2d/" title="cocos2d" rel="tag nofollow">cocos2d</a>, <a href="http://iphone.longearth.net/tag/%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab/" title="チュートリアル" rel="tag nofollow">チュートリアル</a>, <a href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/" title="ライブラリ" rel="tag nofollow">ライブラリ</a></p>

	<h4>関連する投稿</h4>
	<ul class="st-related-posts">
	<li><a href="http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91hello-world/" title="【cocos2d入門】Hello World! (2009 年 12 月 7 日)">【cocos2d入門】Hello World!</a> </li>
	<li><a href="http://iphone.longearth.net/2009/12/11/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88/" title="【cocos2d入門】cocos2dのイベント (2009 年 12 月 11 日)">【cocos2d入門】cocos2dのイベント</a> </li>
	<li><a href="http://iphone.longearth.net/2009/12/09/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3/" title="【cocos2d入門】cocos2dのアニメーション (2009 年 12 月 9 日)">【cocos2d入門】cocos2dのアニメーション</a> </li>
	<li><a href="http://iphone.longearth.net/2009/01/19/%e3%80%90uitableview%e3%80%91%e9%81%b8%e6%8a%9e%e8%a1%8c%e3%81%8b%e3%82%89%e5%88%a5%e7%94%bb%e9%9d%a2%e3%82%92%e5%91%bc%e3%81%b3%e5%87%ba%e3%81%99/" title="【UITableView】選択行から別画面を呼び出す (2009 年 1 月 19 日)">【UITableView】選択行から別画面を呼び出す</a> </li>
	<li><a href="http://iphone.longearth.net/2009/01/20/%e3%80%90uitableview%e3%80%91uitableview%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e8%a9%b3%e7%b4%b0%e7%94%bb%e9%9d%a2%e3%82%92%e4%bd%9c%e3%82%8b-1%e3%80%90uitableviewdatasource%e3%80%91/" title="【UITableView】UITableViewを使って詳細画面を作る-1【UITableViewDataSource】 (2009 年 1 月 20 日)">【UITableView】UITableViewを使って詳細画面を作る-1【UITableViewDataSource】</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://iphone.longearth.net/2009/12/07/%e3%80%90cocos2d%e5%85%a5%e9%96%80%e3%80%91cocos2d%e3%81%ae%e5%b0%8e%e5%85%a5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【iPhone】coverflowを簡単に実装できるライブラリ</title>
		<link>http://iphone.longearth.net/2009/12/06/%e3%80%90iphone%e3%80%91coverflow%e3%82%92%e7%b0%a1%e5%8d%98%e3%81%ab%e5%ae%9f%e8%a3%85%e3%81%a7%e3%81%8d%e3%82%8b%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/</link>
		<comments>http://iphone.longearth.net/2009/12/06/%e3%80%90iphone%e3%80%91coverflow%e3%82%92%e7%b0%a1%e5%8d%98%e3%81%ab%e5%ae%9f%e8%a3%85%e3%81%a7%e3%81%8d%e3%82%8b%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 00:00:14 +0000</pubDate>
		<dc:creator>daichi</dc:creator>
				<category><![CDATA[未分類]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[AR]]></category>
		<category><![CDATA[coverflow]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objecti]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[undocumented API]]></category>
		<category><![CDATA[アプリ]]></category>
		<category><![CDATA[ライブラリ]]></category>

		<guid isPermaLink="false">http://iphone.longearth.net/?p=1559</guid>
		<description><![CDATA[


iPhoneアプリ開発者なら一度はCoverflowを実装してみたいと思うはず。

coverflowの実現方法は、以前からエリカ様の書籍にて公開されていましたが、undocumentedなAPIを使っているため、 [...]]]></description>
			<content:encoded><![CDATA[<p>
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/OpenFlowDemo.png"><img src="http://iphone.longearth.net/wp-content/uploads/2009/12/OpenFlowDemo-300x161.png" alt="OpenFlowDemo" title="OpenFlowDemo" width="300" height="161" class="alignleft size-medium wp-image-1572" /></a><br />
<br />
iPhoneアプリ開発者なら一度はCoverflowを実装してみたいと思うはず。<br />
<br />
coverflowの実現方法は、以前からエリカ様の書籍にて公開されていましたが、undocumentedなAPIを使っているため、おそらくあの方法では申請したところでAppleに蹴られて終わりでしょう。最近はundocumented API検出ツールのようなものをAppleが使って審査してるという話もあるので、審査の目は前よりも厳しくなってる気がします。<br />
<br />
となると、自力で実装していくしかないのですが、ちょうどよいライブラリがあったので、早速試してみる。<br />
<br />
<span id="more-1559"></span><br />
<a href="http://github.com/thefaj/OpenFlow">thefaj&#8217;s OpenFlow at master &#8211; GitHub</a><br />
<br />
使い方はREADMEにも書いてあるとおり、<br />
<ol>
	<li> OpenFlowのソースをプロジェクトへコピー</li>
	<li> CoreGraphics.frameworkとQuartzCore.frameworkをプロジェクトへ追加</li>
	<li>AFOpenFlowView.hをインポート</li>
	<li>AFOpenFlowViewDelegate と AFOpenFlowViewDataSourceのプロトコルを実装する</li>
</ol>
Delegateの方のプロトコルはoptionalなのでひとまずDataSourceの方だけでみると<br />
<ul>
	<li> &#8211; (void)openFlowView:(AFOpenFlowView *)openFlowView requestImageForIndex:(int)index</li>
	<li> &#8211; (UIImage *)defaultImage</li>
</ul>
の２つ。<br />
<br />
サンプルはこんな感じです。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1559code42'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p155942"><td class="code" id="p1559code42"><pre class="objective-c" style="font-family:monospace;">#import &quot;RootViewController.h&quot;
#import &quot;AFOpenFlowView.h&quot;
&nbsp;
@implementation RootViewController
&nbsp;
@synthesize flowView;
&nbsp;
- (void)viewDidLoad {
	[super viewDidLoad];
&nbsp;
	CGRect frame = [UIScreen mainScreen].applicationFrame;
	flowView = [[AFOpenFlowView alloc] initWithFrame:frame];
	flowView.dataSource = self;
	flowView.viewDelegate = self;
	flowView.backgroundColor = [UIColor blackColor];
	[flowView setNumberOfImages:10];
	[self.view addSubview:flowView];
}
&nbsp;
- (void)openFlowView:(AFOpenFlowView *)openFlowView requestImageForIndex:(int)index {
	[flowView setImage:[UIImage imageNamed:@&quot;camera.png&quot;] forIndex:index];
}
&nbsp;
- (UIImage *)defaultImage {
	return [UIImage imageNamed:@&quot;camera.png&quot;];
}
&nbsp;
- (void)dealloc {
　[flowView release];
    [super dealloc];
}
&nbsp;
@end</pre></td></tr></table></div>

<br />
<br />
viewDidLoadあたりでAFOpenFlowViewを初期化。<br />
dataSourceとdelegate(propertyはviewDelegate)にcontrollerをセット。<br />
coverflowで表示したい画像数をセット。<br />
<br />
あとはrequestImageForIndexでindex番目の画像をAFOpenFlowViewにセット。<br />
デフォルトの画像はdefaultImageで設定できる。<br />
<br />
完成はこんな感じ。<br />
<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/12/c1b41aa725c3cf74ae8f99dc7a520065.png"><img src="http://iphone.longearth.net/wp-content/uploads/2009/12/c1b41aa725c3cf74ae8f99dc7a520065-161x300.png" alt="coverflow" title="coverflow" width="161" height="300" class="alignleft size-medium wp-image-1566" /></a></p>

	<p>タグ: <a href="http://iphone.longearth.net/tag/api/" title="API" rel="tag nofollow">API</a>, <a href="http://iphone.longearth.net/tag/ar/" title="AR" rel="tag nofollow">AR</a>, <a href="http://iphone.longearth.net/tag/coverflow/" title="coverflow" rel="tag nofollow">coverflow</a>, <a href="http://iphone.longearth.net/tag/iphone/" title="iphone" rel="tag nofollow">iphone</a>, <a href="http://iphone.longearth.net/tag/objecti/" title="objecti" rel="tag nofollow">objecti</a>, <a href="http://iphone.longearth.net/tag/objective-c/" title="objective-c" rel="tag nofollow">objective-c</a>, <a href="http://iphone.longearth.net/tag/undocumented-api/" title="undocumented API" rel="tag nofollow">undocumented API</a>, <a href="http://iphone.longearth.net/tag/%e3%82%a2%e3%83%97%e3%83%aa/" title="アプリ" rel="tag nofollow">アプリ</a>, <a href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/" title="ライブラリ" rel="tag nofollow">ライブラリ</a></p>

	<h4>関連する投稿</h4>
	<ul class="st-related-posts">
	<li><a href="http://iphone.longearth.net/2009/08/16/%e3%80%90iphone%e3%80%91objective-c%e3%81%a7atompub%e3%82%92%e7%b0%a1%e5%8d%98%e3%81%ab%e6%93%8d%e4%bd%9c%e3%81%a7%e3%81%8d%e3%82%8b%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e5%85%ac%e9%96%8b/" title="【iPhone】Objective-CでAtomPubを簡単に操作できるライブラリ公開してみた (2009 年 8 月 16 日)">【iPhone】Objective-CでAtomPubを簡単に操作できるライブラリ公開してみた</a> </li>
	<li><a href="http://iphone.longearth.net/2009/08/12/%e3%80%90iphone%e3%80%91kissxml%e3%81%a7%e5%bf%ab%e9%81%a9%e3%83%91%e3%83%bc%e3%82%b9%e7%94%9f%e6%b4%bb/" title="【iPhone】KissXMLで快適パース生活 (2009 年 8 月 12 日)">【iPhone】KissXMLで快適パース生活</a> </li>
	<li><a href="http://iphone.longearth.net/2009/02/15/%e3%80%90iphone%e3%80%91%e7%94%bb%e5%83%8f%e3%82%92%e3%83%95%e3%82%a9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%81%ab%e4%bf%9d%e5%ad%98%e3%81%99%e3%82%8b/" title="【iPhone】画像をフォトライブラリに保存する (2009 年 2 月 15 日)">【iPhone】画像をフォトライブラリに保存する</a> </li>
	<li><a href="http://iphone.longearth.net/2009/05/22/%e3%80%90iphone%e3%80%91%e3%80%90three20%e3%80%91doxygen%e3%81%a7%e7%a5%9e%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%81%ae%e3%83%89%e3%82%ad%e3%83%a5%e3%83%a1%e3%83%b3%e3%83%88%e7%94%9f%e6%88%90/" title="【iPhone】【Three20】doxygenで神ライブラリのドキュメント生成してみた (2009 年 5 月 22 日)">【iPhone】【Three20】doxygenで神ライブラリのドキュメント生成してみた</a> </li>
	<li><a href="http://iphone.longearth.net/2009/07/06/%e3%80%90iphone%e3%80%91%e3%80%90objective-c%e3%80%91twitter%e3%81%ab%e3%81%a4%e3%81%b6%e3%82%84%e3%81%8d%e3%82%92%e3%83%9d%e3%82%b9%e3%83%88%e3%81%99%e3%82%8b/" title="【iPhone】【Objective-C】Twitterにつぶやきをポストする (2009 年 7 月 6 日)">【iPhone】【Objective-C】Twitterにつぶやきをポストする</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://iphone.longearth.net/2009/12/06/%e3%80%90iphone%e3%80%91coverflow%e3%82%92%e7%b0%a1%e5%8d%98%e3%81%ab%e5%ae%9f%e8%a3%85%e3%81%a7%e3%81%8d%e3%82%8b%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>【iPhone】Objective-CでAtomPubを簡単に操作できるライブラリ公開してみた</title>
		<link>http://iphone.longearth.net/2009/08/16/%e3%80%90iphone%e3%80%91objective-c%e3%81%a7atompub%e3%82%92%e7%b0%a1%e5%8d%98%e3%81%ab%e6%93%8d%e4%bd%9c%e3%81%a7%e3%81%8d%e3%82%8b%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e5%85%ac%e9%96%8b/</link>
		<comments>http://iphone.longearth.net/2009/08/16/%e3%80%90iphone%e3%80%91objective-c%e3%81%a7atompub%e3%82%92%e7%b0%a1%e5%8d%98%e3%81%ab%e6%93%8d%e4%bd%9c%e3%81%a7%e3%81%8d%e3%82%8b%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e5%85%ac%e9%96%8b/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 02:33:50 +0000</pubDate>
		<dc:creator>daichi</dc:creator>
				<category><![CDATA[開発補助]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[AtomPub]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[iTaskTimer]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[NSString]]></category>
		<category><![CDATA[objecti]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[はてなブックマーク]]></category>
		<category><![CDATA[アプリ]]></category>
		<category><![CDATA[ソフト]]></category>
		<category><![CDATA[ダウンロード]]></category>
		<category><![CDATA[ライセンス]]></category>
		<category><![CDATA[ライブラリ]]></category>

		<guid isPermaLink="false">http://iphone.longearth.net/?p=1351</guid>
		<description><![CDATA[
daichi1128&#8217;s DCAtomPub at master &#8211; GitHub

はてなブックマークの登録をiPhoneアプリから行うにははてなのAtomPub APIを叩く必要がありますが [...]]]></description>
			<content:encoded><![CDATA[<p>
<a href="http://github.com/daichi1128/DCAtomPub/tree/master">daichi1128&#8217;s DCAtomPub at master &#8211; GitHub</a><br />
<br />
はてなブックマークの登録をiPhoneアプリから行うにははてなのAtomPub APIを叩く必要がありますが、WSSE認証やらsha1やらbase64エンコードやらISO8061やらXMLポストやらでハマリ倒してしまったので、二度とつまずかないためにもライブラリ化してみた。<br />
ライブラリというほど大げさなものでもないのですが、ソースコード公開デビューということで大目にみてやってください。<br />
<br />
Objective-CでAtomPubを簡単に操作するライブラリDCAtomPubをgithubに公開しました。<br />
ライセンスは修正BSDライセンスです。<br />
<br />
AtomPubに関する情報は<a href="http://tools.ietf.org/rfc/rfc5023.txt">こちらから</a>。<br />
日本語訳はこれ。<a href="http://www.ricoh.co.jp/src/rd/webtech/rfc5023_ja.html">ソフトウェア分野の研究開発 / RFC 5023 Atom Publishing Protocol 日本語訳 | Ricoh Japan</a><br />
<br />
はてなブックマークAPIはこちらから。<br />
<a href="http://d.hatena.ne.jp/keyword/%A4%CF%A4%C6%A4%CA%A5%D6%A5%C3%A5%AF%A5%DE%A1%BC%A5%AFAtomAPI">はてなブックマークAtomAPIとは &#8211; はてなキーワード</a><br />
<br />
<h3>セットアップ</h3>
ターミナルから以下のコマンドでダウンロード（要gitクライアント)<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1351code51'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p135151"><td class="code" id="p1351code51"><pre class="shell" style="font-family:monospace;">git clone git://github.com/daichi1128/DCAtomPub.git</pre></td></tr></table></div>

<br />
githubからダウンロードしたら、Xcodeで起動し、DCAtomPubグループ内のファイル群を自分のプロジェクトにコピー。はてな用クライアントも必要ならHatenaExample内のファイルもコピー。<br />
<br />
<h3>使い方</h3>
<h4>WSSE認証</h4>
DCAtomPubClinetの初期化メソッドの引数にユーザ名、パスワードを渡してあげれば面倒なWSSE認証の準備は勝手にDCAtomPubClientがやります。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1351code52'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p135152"><td class="code" id="p1351code52"><pre class="objective-c" style="font-family:monospace;">NSString *username = @&quot;user&quot;;
NSString *password = @&quot;pass&quot;;
DCAtomPubClient *atomClient = [[DCAtomPubClient alloc] initWithUsername:username password:password];</pre></td></tr></table></div>

<br />
正確にはリクエストを投げるまでにユーザ名、パスワードがセットされていればリクエスト送信時にうまいことやってくれます。こんな形でもよいです。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1351code53'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p135153"><td class="code" id="p1351code53"><pre class="objective-c" style="font-family:monospace;">DCAtomPubClient *atomClient = [[DCAtomPubClient alloc] init];
atomClient.username = @&quot;user&quot;;
atomClient.password = @&quot;pass&quot;;</pre></td></tr></table></div>

<br />
<h4>POST</h4>
AtomPubのPOSTメソッドはDCAtomPubClientクラスのpost:XMLString:メソッドで行います。<br />
はてぶでは登録時にPOSTメソッドでXMLを投げます。<br />
サンプルコードはこんな感じです。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1351code54'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p135154"><td class="code" id="p1351code54"><pre class="objective-c" style="font-family:monospace;">        NSString *username = @&quot;user&quot;;
        NSString *password = @&quot;pass&quot;;
	/** 
	 *AtomPubクライアントではてなブックマークを追加
	 */
	DCAtomPubClient *atomClient = [[DCAtomPubClient alloc] initWithUsername:username password:password];
	atomClient.delegate = [[DummyDelegate alloc] init];
&nbsp;
	NSString *hatenaPostURL = @&quot;http://b.hatena.ne.jp/atom/post&quot;;
	NSString *postXMLTemplate = 
	@&quot;&lt;entry xmlns=\&quot;http://purl.org/atom/ns#\&quot;&gt;&quot;
	@&quot;&lt;link rel=\&quot;related\&quot; type=\&quot;text/html\&quot; href=\&quot;%@\&quot; /&gt;&quot;
	@&quot;&lt;summary type=\&quot;text/plain\&quot;&gt;%@&lt;/summary&gt;&quot;
	@&quot;&lt;/entry&gt;&quot;;
&nbsp;
	// POSTメソッドでXMLを送信
	[atomClient post:hatenaPostURL XMLString:[NSString stringWithFormat:
		  postXMLTemplate, 
		  @&quot;http://iphone.longearth.net/itasktimer/&quot;,@&quot;DCAtomPubから&quot; ]];</pre></td></tr></table></div>

<br />
<h4>PUT</h4>
はてなブックマークの編集時にAtomPubのPUTメソッドを使います。使い方はPOST時と同じように、DCAtomPubClientのput:XMLString:を呼べばOKです。<br />
<h4>DELETE</h4>
はてなブックマークの削除時にAtomPubのDELETEメソッドを使います。使い方はPOST、PUTと同じです。DCAtomPubClientのdelete:XMLStringを呼びます。はてなブックマークの場合はXMLStringはnilでOKです。<br />
<h3>はてなクライアントの使い方</h3>
AtomPubの扱いは上のDCAtomPubClientでだいぶ簡略化できたけど、いちいちXMLを調べて組み立てるのが面倒だ。なのではてな用AtomPubクライアントも作りました。<br />
DCHatenaClient。DCAtomPubClientを継承してます。<br />
<h4>ブックマークを追加する</h4>
DCHatenaClientを使ってブックマークを登録するには、DCHatenaClientの<br />
- (void)post:(NSString *)bookmarkURL comment:(NSString *)comment;<br />
メソッドで行います。<br />
引数にはブックマークするURLとコメントを渡してあげます。<br />
サンプルはこんな感じです。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1351code55'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p135155"><td class="code" id="p1351code55"><pre class="objective-c" style="font-family:monospace;">	/** 
	 * はてなブックマーク用クライアントではてなブックマークを追加
	 */
	DCHatenaClient *hatenaClient = [[DCHatenaClient alloc] initWithUsername:username password:password];
	[hatenaClient post:@&quot;http://iphone.longearth.net&quot; comment:@&quot;DCHatenaClientから&quot;];</pre></td></tr></table></div>

<br />
 だいぶすっきりします。<br />
<h4>ブックマークを編集する</h4>
ブックマーク編集は<br />
- (void)edit:(NSString *)eid title:(NSString *)title comment:(NSString *)comment;<br />
で行います。<br />
引数に編集するエントリID、変更後のタイトル、変更後のコメントを渡します。はてぶAPI的にタイトルとコメントいずれか必須らしいのでそうしてください。変更したくないものはnilを渡します。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1351code56'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p135156"><td class="code" id="p1351code56"><pre class="objective-c" style="font-family:monospace;">	DCHatenaClient *hatenaClient = [[DCHatenaClient alloc] initWithUsername:username password:password];
	[hatenaClient edit:@&quot;15151515&quot; title:@&quot;変更後のタイトル&quot; comment:nil];</pre></td></tr></table></div>

<br />
すっきりですね。<br />
<h4>ブックマークを削除する</h4>
ブックマーク削除は<br />
- (void)delete:(NSString *)eid;<br />
で行います。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1351code57'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p135157"><td class="code" id="p1351code57"><pre class="objective-c" style="font-family:monospace;">	DCHatenaClient *hatenaClient = [[DCHatenaClient alloc] initWithUsername:username password:password];
	[hatenaClient delete:@&quot;15151515&quot;];</pre></td></tr></table></div>

<br />
もうAtomPub恐るるに足らずです。<br />
<h3>その他</h3>
デリゲートとしてDCAtomPubDelegateを用意しています。呼べるものはNSURLConnection系を周到してます。こんな感じです。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1351code58'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p135158"><td class="code" id="p1351code58"><pre class="objective-c" style="font-family:monospace;">- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response;
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
- (void)connectionDidFinishLoading:(NSURLConnection *)connection data:(NSData *)data;
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error;</pre></td></tr></table></div>

<br />
<br />
リクエストを投げる前に<br />
dcAtomPubClinet.delegate = self;<br />
などとしてセットしてあげればNSURLConnectionと同じ感覚で使えるはずです。<br />
<br />
mixiの隠しAPIもAtomPubらしいので、うまくいけば使えるかもしれません。まだ試してない。<br />
※本来ならAtomPubのルートエンドポイントからアクセス可能なURLを引っ張ってくるのがAtomPub的に正しいことらしいのですが、面倒なので今回はそこまでしてません。<br />
<h3>参考</h3>
<a href="http://d.hatena.ne.jp/keyword/%A4%CF%A4%C6%A4%CA%A5%D6%A5%C3%A5%AF%A5%DE%A1%BC%A5%AFAtomAPI">はてなブックマークAtomAPIとは &#8211; はてなキーワード</a><br />
<a href="http://d.hatena.ne.jp/KishikawaKatsumi/20080928/1222620949">CocoaでWSSE認証 &#8211; 24/7 twenty-four seven</a><br />
<a href="http://projects.stoneship.org/hg/cocoa_crypto_hashing/summary">cocoa_crypto_hashing: Summary</a><br />
<a href="http://homepage.mac.com/t_yamane/prog/Base64/page.html">NSDataにBase64のエンコード・デコード機能を追加する</a><br />
<br />
</p>

	<p>タグ: <a href="http://iphone.longearth.net/tag/api/" title="API" rel="tag nofollow">API</a>, <a href="http://iphone.longearth.net/tag/atompub/" title="AtomPub" rel="tag nofollow">AtomPub</a>, <a href="http://iphone.longearth.net/tag/iphone/" title="iphone" rel="tag nofollow">iphone</a>, <a href="http://iphone.longearth.net/tag/itasktimer/" title="iTaskTimer" rel="tag nofollow">iTaskTimer</a>, <a href="http://iphone.longearth.net/tag/mac/" title="mac" rel="tag nofollow">mac</a>, <a href="http://iphone.longearth.net/tag/nsstring/" title="NSString" rel="tag nofollow">NSString</a>, <a href="http://iphone.longearth.net/tag/objecti/" title="objecti" rel="tag nofollow">objecti</a>, <a href="http://iphone.longearth.net/tag/objective-c/" title="objective-c" rel="tag nofollow">objective-c</a>, <a href="http://iphone.longearth.net/tag/xcode/" title="Xcode" rel="tag nofollow">Xcode</a>, <a href="http://iphone.longearth.net/tag/xml/" title="XML" rel="tag nofollow">XML</a>, <a href="http://iphone.longearth.net/tag/%e3%81%af%e3%81%a6%e3%81%aa%e3%83%96%e3%83%83%e3%82%af%e3%83%9e%e3%83%bc%e3%82%af/" title="はてなブックマーク" rel="tag nofollow">はてなブックマーク</a>, <a href="http://iphone.longearth.net/tag/%e3%82%a2%e3%83%97%e3%83%aa/" title="アプリ" rel="tag nofollow">アプリ</a>, <a href="http://iphone.longearth.net/tag/%e3%82%bd%e3%83%95%e3%83%88/" title="ソフト" rel="tag nofollow">ソフト</a>, <a href="http://iphone.longearth.net/tag/%e3%83%80%e3%82%a6%e3%83%b3%e3%83%ad%e3%83%bc%e3%83%89/" title="ダウンロード" rel="tag nofollow">ダウンロード</a>, <a href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%82%bb%e3%83%b3%e3%82%b9/" title="ライセンス" rel="tag nofollow">ライセンス</a>, <a href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/" title="ライブラリ" rel="tag nofollow">ライブラリ</a></p>

	<h4>関連する投稿</h4>
	<ul class="st-related-posts">
	<li><a href="http://iphone.longearth.net/2009/08/12/%e3%80%90iphone%e3%80%91kissxml%e3%81%a7%e5%bf%ab%e9%81%a9%e3%83%91%e3%83%bc%e3%82%b9%e7%94%9f%e6%b4%bb/" title="【iPhone】KissXMLで快適パース生活 (2009 年 8 月 12 日)">【iPhone】KissXMLで快適パース生活</a> </li>
	<li><a href="http://iphone.longearth.net/2009/09/01/%e3%80%90iphone%e3%80%91push-notification%e3%81%ae%e5%ae%9f%e8%a3%85%e6%96%b9%e6%b3%95/" title="【iPhone】Push Notificationの実装方法 (2009 年 9 月 1 日)">【iPhone】Push Notificationの実装方法</a> </li>
	<li><a href="http://iphone.longearth.net/2009/08/09/%e3%80%90xcode%e3%80%91%e8%a8%ad%e5%ae%9a%e3%81%97%e3%81%a6%e3%81%8a%e3%81%8f%e3%81%a8%e4%be%bf%e5%88%a9%e3%81%aa%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%9e%e3%82%a4%e3%82%ba%e3%81%84%e3%82%8d%e3%81%84/" title="【Xcode】設定しておくと便利なカスタマイズいろいろ (2009 年 8 月 9 日)">【Xcode】設定しておくと便利なカスタマイズいろいろ</a> </li>
	<li><a href="http://iphone.longearth.net/2009/07/06/%e3%80%90iphone%e3%80%91%e3%80%90objective-c%e3%80%91twitter%e3%81%ab%e3%81%a4%e3%81%b6%e3%82%84%e3%81%8d%e3%82%92%e3%83%9d%e3%82%b9%e3%83%88%e3%81%99%e3%82%8b/" title="【iPhone】【Objective-C】Twitterにつぶやきをポストする (2009 年 7 月 6 日)">【iPhone】【Objective-C】Twitterにつぶやきをポストする</a> </li>
	<li><a href="http://iphone.longearth.net/2008/12/31/%e3%80%90uitableview%e3%80%91uitableview%e3%81%ab%e6%96%87%e5%ad%97%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%99%e3%82%8b/" title="【UITableView】UITableViewに文字を表示する (2008 年 12 月 31 日)">【UITableView】UITableViewに文字を表示する</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://iphone.longearth.net/2009/08/16/%e3%80%90iphone%e3%80%91objective-c%e3%81%a7atompub%e3%82%92%e7%b0%a1%e5%8d%98%e3%81%ab%e6%93%8d%e4%bd%9c%e3%81%a7%e3%81%8d%e3%82%8b%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e5%85%ac%e9%96%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【iPhone】KissXMLで快適パース生活</title>
		<link>http://iphone.longearth.net/2009/08/12/%e3%80%90iphone%e3%80%91kissxml%e3%81%a7%e5%bf%ab%e9%81%a9%e3%83%91%e3%83%bc%e3%82%b9%e7%94%9f%e6%b4%bb/</link>
		<comments>http://iphone.longearth.net/2009/08/12/%e3%80%90iphone%e3%80%91kissxml%e3%81%a7%e5%bf%ab%e9%81%a9%e3%83%91%e3%83%bc%e3%82%b9%e7%94%9f%e6%b4%bb/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 20:53:44 +0000</pubDate>
		<dc:creator>daichi</dc:creator>
				<category><![CDATA[iphone開発]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[KissXML]]></category>
		<category><![CDATA[NSArray]]></category>
		<category><![CDATA[objecti]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[はてなブックマーク]]></category>
		<category><![CDATA[アプリ]]></category>
		<category><![CDATA[カメラ]]></category>
		<category><![CDATA[ダウンロード]]></category>
		<category><![CDATA[ライブラリ]]></category>
		<category><![CDATA[リスト]]></category>
		<category><![CDATA[音]]></category>

		<guid isPermaLink="false">http://iphone.longearth.net/?p=1327</guid>
		<description><![CDATA[
Web APIを使うiPhoneアプリにはXMLのパースは必要不可欠。アプリ開発者のみなさんはXMLのパースはどのようにしているのでしょう。NSXMLParser、libxml、TouchXML、KissXMLいろいろ [...]]]></description>
			<content:encoded><![CDATA[<p>
Web APIを使うiPhoneアプリにはXMLのパースは必要不可欠。アプリ開発者のみなさんはXMLのパースはどのようにしているのでしょう。NSXMLParser、libxml、TouchXML、KissXMLいろいろ方法はありますが、今回使ってみて結構使い勝手がよかったKissXMLの使い方を書いてみます。<br />
<span id="more-1327"></span><br />
<h3>KissXMLの導入</h3>
<h4>ダウンロード</h4>
まずはKissXMLをダウンロード。<br />
ダウンロードはコンソールから下のコマンドをたたく。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1327code68'); return false;">View Code</a> SHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p132768"><td class="code" id="p1327code68"><pre class="shell" style="font-family:monospace;">svn checkout http://kissxml.googlecode.com/svn/trunk/ kissxml-read-only</pre></td></tr></table></div>

<br />
<h4>プロジェクトで使えるようにする</h4>
ダウンロードが出来たらKissXML.xcodeprojをポチポチっと起動。<br />
DDXMLグループの中身を全て自分のプロジェクトへコピー。<br />
<br />
その後はプロジェクトのアクティブターゲットを編集から<br />
    * 他のリンカフラグ = -lxml2<br />
    * ヘッダ検索パス = /usr/include/libxml2 <br />
を設定すれば準備完了。<br />
<h3>使い方</h3>
iPhoneでXMLをパースする機会と言うとほぼほぼWeb APIからのレスポンス解析だと思うので、そういう前提でいきます。ここではGoogle ReaderのAtomを解析してみます。<br />
Google Readerからのレスポンスはhttp://www.google.com/reader/atom/をブラウザから叩くと確認できます。もちろんGoogleにログインしていないと見れません。<br />
<br />
まず、XMLレスポンスを受け取ったらNSDataからDDXMLDocumentを作る。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1327code69'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p132769"><td class="code" id="p1327code69"><pre class="objective-c" style="font-family:monospace;">DDXMLDocument *doc = [[[DDXMLDocument alloc] initWithData:data options:0 error:&amp;error] autorelease];</pre></td></tr></table></div>

<br />
次にルートエレメントを取り出す。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1327code70'); return false;">View Code</a> OBUJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p132770"><td class="code" id="p1327code70"><pre class="obujective-c" style="font-family:monospace;">DDXMLElement *root = [doc rootElement];</pre></td></tr></table></div>

<br />
Google Readerからのレスポンスを見てみるとルートのfeedエレメントにはnamespaceをたくさん指定しています。こんな感じです。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1327code71'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p132771"><td class="code" id="p1327code71"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feed</span> <span style="color: #000066;">xmlns:idx</span>=<span style="color: #ff0000;">&quot;urn:atom-extension:indexing&quot;</span> <span style="color: #000066;">xmlns:gr</span>=<span style="color: #ff0000;">&quot;http://www.google.com/schemas/reader/atom/&quot;</span> <span style="color: #000066;">xmlns:media</span>=<span style="color: #ff0000;">&quot;http://search.yahoo.com/mrss/&quot;</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2005/Atom&quot;</span> <span style="color: #000066;">idx:index</span>=<span style="color: #ff0000;">&quot;no&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></td></tr></table></div>

<br />
なのでこれらをルートエレメントに教えてやる。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1327code72'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p132772"><td class="code" id="p1327code72"><pre class="objective-c" style="font-family:monospace;">[root addNamespace:[DDXMLNode namespaceWithName:@&quot;idx&quot; stringValue:@&quot;urn:atom-extension:indexing&quot;]];
[root addNamespace:[DDXMLNode namespaceWithName:@&quot;gr&quot; stringValue:@&quot;http://www.google.com/schemas/reader/atom/&quot;]];
[root addNamespace:[DDXMLNode namespaceWithName:@&quot;media&quot; stringValue:@&quot;http://search.yahoo.com/mrss/&quot;]];
[root addNamespace:[DDXMLNode namespaceWithName:@&quot;foo&quot; stringValue:@&quot;http://www.w3.org/2005/Atom&quot;]];</pre></td></tr></table></div>

<br />
これで取り出す準備完了。defaultのnamespaceであるhttp://www.w3.org/2005/Atomには適当にfooという名前を付けた。<br />
<br />
以下はGoogle ReaderからのAtomの一部抜粋。全部は長過ぎるため２件分だけ。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1327code73'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p132773"><td class="code" id="p1327code73"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feed</span> <span style="color: #000066;">xmlns:idx</span>=<span style="color: #ff0000;">&quot;urn:atom-extension:indexing&quot;</span> <span style="color: #000066;">xmlns:gr</span>=<span style="color: #ff0000;">&quot;http://www.google.com/schemas/reader/atom/&quot;</span> <span style="color: #000066;">xmlns:media</span>=<span style="color: #ff0000;">&quot;http://search.yahoo.com/mrss/&quot;</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2005/Atom&quot;</span> <span style="color: #000066;">idx:index</span>=<span style="color: #ff0000;">&quot;no&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #808080; font-style: italic;">&lt;!--</span>
<span style="color: #808080; font-style: italic;">Content-type: Preventing XSRF in IE.</span>
<span style="color: #808080; font-style: italic;">--&gt;</span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;generator</span> <span style="color: #000066;">uri</span>=<span style="color: #ff0000;">&quot;http://www.google.com/reader&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Google Reader<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/generator<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>tag:google.com,2005:reader/user/10689165820831989733/state/com.google/reading-list<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Daichi の Google リーダー購読リスト<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gr:continuation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CJzIrMuvmZwC<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gr:continuation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;self&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://www.google.com/reader/atom/&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;author<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Daichi<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2009-08-10T16:06:18Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">gr:crawl-timestamp-msec</span>=<span style="color: #ff0000;">&quot;1249920378537&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id</span> <span style="color: #000066;">gr:original-id</span>=<span style="color: #ff0000;">&quot;http://www.itmedia.co.jp/news/articles/0908/10/news045.html&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>tag:google.com,2005:reader/item/7b14ce7e8094cf36<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;user/10689165820831989733/label/はてな&quot;</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://www.google.com/reader/&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;はてな&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;user/10689165820831989733/state/com.google/reading-list&quot;</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://www.google.com/reader/&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;reading-list&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;user/10689165820831989733/state/com.google/fresh&quot;</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://www.google.com/reader/&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;fresh&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;スポーツ・芸能・音楽&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;html&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>ねとらぼ：酒井法子容疑者の「碧いうさぎ」、iTunes Storeで2位に - ITmedia News<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2009-08-10T06:10:05Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2009-08-10T06:10:05Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;alternate&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://www.itmedia.co.jp/news/articles/0908/10/news045.html&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/html&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;content</span> <span style="color: #000066;">xml:base</span>=<span style="color: #ff0000;">&quot;http://b.hatena.ne.jp/hotentry&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;html&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #ddbb00;">&amp;lt;</span>blockquote title=&quot;ねとらぼ：酒井法子容疑者の「碧いうさぎ」、iTunes Storeで2位に - ITmedia News&quot;<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>cite<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>img
src=&quot;http://favicon.st-hatena.com/?url=http0X1.30E20927D8A28P-10090.0000000.000000www.itmedia.co.jp0.000000news-0.000000articles0.0000000908-0.000000100.000000news045.html&quot; alt=&quot;&quot;<span style="color: #ddbb00;">&amp;gt;</span> <span style="color: #ddbb00;">&amp;lt;</span>a
href=&quot;http://www.itmedia.co.jp/news/articles/0908/10/news045.html&quot;<span style="color: #ddbb00;">&amp;gt;</span>ねとらぼ：酒井法子容疑者の「碧いうさぎ」、iTunes Storeで2位に - ITmedia News<span style="color: #ddbb00;">&amp;lt;</span>/a<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/cite<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>p<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>a href=&quot;http://www.itmedia.co.jp/news/articles/0908/10/news045.html&quot;<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>img
src=&quot;http://img.b.hatena.ne.jp/entryimage/15253758-1249897906.jpg&quot; alt=&quot;ねとらぼ：酒井法子容疑者の「碧いうさぎ」、iTunes Storeで2位に - ITmedia News&quot; title=&quot;ねとらぼ：酒井法子容疑者の「碧いうさぎ」、iTunes Storeで2位に - ITmedia
News&quot;<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/a<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/p<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>p<span style="color: #ddbb00;">&amp;gt;</span>ニュースねとらぼ：酒井法子容疑者の「碧いうさぎ」、iTunes Storeで2位に覚醒剤取締法違反の疑いで逮捕された酒井法子容疑者の楽曲の「iTunes Store」販売ランキングが急上昇している。2009年08月10日 14時45分 更新iTunes Storeのアルバムランキング覚醒剤取締法違反の疑いで8月8日に逮捕された酒井法子容疑者の楽曲が、「iTunes
Store」販売ラン...<span style="color: #ddbb00;">&amp;lt;</span>/p<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>p<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>a href=&quot;http://b.hatena.ne.jp/entry/http://www.itmedia.co.jp/news/articles/0908/10/news045.html&quot;<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>img
src=&quot;http://b.hatena.ne.jp/entry/image/http://www.itmedia.co.jp/news/articles/0908/10/news045.html&quot; alt=&quot;はてなブックマーク - ねとらぼ：酒井法子容疑者の「碧いうさぎ」、iTunes Storeで2位に - ITmedia News&quot; title=&quot;はてなブックマーク - ねとらぼ：酒井法子容疑者の「碧いうさぎ」、iTunes Storeで2位に - ITmedia
News&quot; border=&quot;0&quot; style=&quot;border:none&quot;<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/a<span style="color: #ddbb00;">&amp;gt;</span> <span style="color: #ddbb00;">&amp;lt;</span>a href=&quot;http://b.hatena.ne.jp/append?http://www.itmedia.co.jp/news/articles/0908/10/news045.html&quot;<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>img src=&quot;http://b.hatena.ne.jp/images/append.gif&quot; border=&quot;0&quot; alt=&quot;はてなブックマークに追加&quot;
title=&quot;はてなブックマークに追加&quot;<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/a<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/p<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/blockquote<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>img src=&quot;http://feeds.feedburner.com/~r/hatena/b/hotentry/~4/LMheVEu9xoE&quot; height=&quot;1&quot; width=&quot;1&quot;<span style="color: #ddbb00;">&amp;gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/content<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;author</span> <span style="color: #000066;">gr:unknown-author</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>(投稿者不明)<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source</span> <span style="color: #000066;">gr:stream-id</span>=<span style="color: #ff0000;">&quot;feed/http://feedproxy.google.com/hatena/b/hotentry&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>tag:google.com,2005:reader/feed/http://feedproxy.google.com/hatena/b/hotentry<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;html&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>はてなブックマーク - 人気エントリー<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;alternate&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://b.hatena.ne.jp/hotentry&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/html&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/source<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">gr:crawl-timestamp-msec</span>=<span style="color: #ff0000;">&quot;1249919130170&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id</span> <span style="color: #000066;">gr:original-id</span>=<span style="color: #ff0000;">&quot;http://kengo.preston-net.com/archives/004237.shtml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		tag:google.com,2005:reader/item/e781184cc384d80b
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;user/10689165820831989733/label/はてな&quot;</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://www.google.com/reader/&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;はてな&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;user/10689165820831989733/state/com.google/reading-list&quot;</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://www.google.com/reader/&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;reading-list&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;user/10689165820831989733/state/com.google/fresh&quot;</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">&quot;http://www.google.com/reader/&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;fresh&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">term</span>=<span style="color: #ff0000;">&quot;コンピュータ・IT&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;html&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Going My Way: iPhone のカメラでズーム機能を実現するアプリ、Camera Zoom<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2009-08-10T14:46:02Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2009-08-10T14:46:02Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;alternate&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://kengo.preston-net.com/archives/004237.shtml&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/html&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;content</span> <span style="color: #000066;">xml:base</span>=<span style="color: #ff0000;">&quot;http://b.hatena.ne.jp/t/iphone?sort=eid&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;html&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #ddbb00;">&amp;lt;</span>blockquote title=&quot;Going My Way: iPhone のカメラでズーム機能を実現するアプリ、Camera
Zoom&quot;<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>cite<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>img src=&quot;http://favicon.st-hatena.com/?url=http-0X1.FD6B8P+00.000000-0.000000kengo.preston-net.com0.000000archives-0.000000004237.shtml&quot; alt=&quot;&quot;<span style="color: #ddbb00;">&amp;gt;</span> <span style="color: #ddbb00;">&amp;lt;</span>a
href=&quot;http://kengo.preston-net.com/archives/004237.shtml&quot;<span style="color: #ddbb00;">&amp;gt;</span>Going My Way: iPhone のカメラでズーム機能を実現するアプリ、Camera Zoom<span style="color: #ddbb00;">&amp;lt;</span>/a<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/cite<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>p<span style="color: #ddbb00;">&amp;gt;</span>iPhone のカメラでズーム機能を実現するアプリ、Camera Zoomスポンサード リンクiPhone
のカメラにはズーム機能などがありません。なので遠くの物を撮る際は小さくなってしまいます。近づける場合は近づいて撮ればいいのですがなかなかそうもいかない場合もあります。そんな場合に、ズーム機能をアプリでカバーしてくれる、Camera Zoom というアプリがあるのでこれを入れておく...<span style="color: #ddbb00;">&amp;lt;</span>/p<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>p<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>a
href=&quot;http://b.hatena.ne.jp/entry/http://kengo.preston-net.com/archives/004237.shtml&quot;<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>img src=&quot;http://b.hatena.ne.jp/entry/image/http://kengo.preston-net.com/archives/004237.shtml&quot; alt=&quot;はてなブックマーク - Going My Way: iPhone
のカメラでズーム機能を実現するアプリ、Camera Zoom&quot; title=&quot;はてなブックマーク - Going My Way: iPhone のカメラでズーム機能を実現するアプリ、Camera Zoom&quot; border=&quot;0&quot; style=&quot;border:none&quot;<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/a<span style="color: #ddbb00;">&amp;gt;</span> <span style="color: #ddbb00;">&amp;lt;</span>a
href=&quot;http://b.hatena.ne.jp/append?http://kengo.preston-net.com/archives/004237.shtml&quot;<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>img src=&quot;http://b.hatena.ne.jp/images/append.gif&quot; border=&quot;0&quot; alt=&quot;はてなブックマークに追加&quot;
title=&quot;はてなブックマークに追加&quot;<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/a<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/p<span style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/blockquote<span style="color: #ddbb00;">&amp;gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/content<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;author</span> <span style="color: #000066;">gr:unknown-author</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>(投稿者不明)<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source</span> <span style="color: #000066;">gr:stream-id</span>=<span style="color: #ff0000;">&quot;feed/http://b.hatena.ne.jp/t/iphone?sort=eid&amp;amp;mode=rss&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>tag:google.com,2005:reader/feed/http://b.hatena.ne.jp/t/iphone?sort=eid<span style="color: #ddbb00;">&amp;amp;</span>mode=rss<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;html&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>はてなブックマーク - タグ - iphone<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;alternate&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://b.hatena.ne.jp/t/iphone?sort=eid&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/html&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/source<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/feed<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<br />
この中からフィードのタイトル、フィードのID、エントリーのタイトル、エントリー本文、公開日を抜き取ってみる。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1327code74'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p132774"><td class="code" id="p1327code74"><pre class="objective-c" style="font-family:monospace;"> NSArray *feedTitles = [root nodesForXPath:@&quot;//foo:source/foo:title&quot; error:&amp;error];
 NSArray *feedIds = [root nodesForXPath:@&quot;//foo:source/foo:id&quot; error:&amp;error];
 NSArray *entryTitles = [root nodesForXPath:@&quot;//foo:entry/foo:title&quot; error:&amp;error];
 NSArray *contents = [root nodesForXPath:@&quot;//foo:entry/foo:content&quot; error:&amp;error];
 NSArray *publisheds = [root nodesForXPath:@&quot;//foo:entry/foo:published&quot; error:&amp;error];</pre></td></tr></table></div>

<br />
これでそれぞれの配列で取得できる。<br />
あとはこれをループしてオブジェクトにまとめる。<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1327code75'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p132775"><td class="code" id="p1327code75"><pre class="objective-c" style="font-family:monospace;">    for (NSUInteger i = 0; i &lt; [feedTitles count]; i++) {
		NSMutableDictionary *result = [[[NSMutableDictionary alloc] init] autorelease];
		[result setObject:[[feedIds objectAtIndex:i] stringValue] forKey:@&quot;feed_id&quot;];
		[result setObject:[[feedTitles objectAtIndex:i] stringValue] forKey:@&quot;feed_title&quot;];
		[result setObject:[[entryTitles objectAtIndex:i] stringValue] forKey:@&quot;entry_title&quot;];	
		[result setObject:[[contents objectAtIndex:i] stringValue] forKey:@&quot;content&quot;];
		[result setObject:[[publisheds objectAtIndex:i] stringValue] forKey:@&quot;published&quot;];		
                [self.objects addObject:result];
    }</pre></td></tr></table></div>

<br />
これまでの処理をまとめて書くとこんな感じ<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1327code76'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p132776"><td class="code" id="p1327code76"><pre class="objective-c" style="font-family:monospace;">    DDXMLDocument *doc = [[[DDXMLDocument alloc] initWithData:data options:0 error:&amp;error] autorelease];
&nbsp;
    DDXMLElement *root = [doc rootElement];
    [root addNamespace:[DDXMLNode namespaceWithName:@&quot;idx&quot; stringValue:@&quot;urn:atom-extension:indexing&quot;]];
    [root addNamespace:[DDXMLNode namespaceWithName:@&quot;gr&quot; stringValue:@&quot;http://www.google.com/schemas/reader/atom/&quot;]];
    [root addNamespace:[DDXMLNode namespaceWithName:@&quot;media&quot; stringValue:@&quot;http://search.yahoo.com/mrss/&quot;]];
    [root addNamespace:[DDXMLNode namespaceWithName:@&quot;foo&quot; stringValue:@&quot;http://www.w3.org/2005/Atom&quot;]];
&nbsp;
    NSArray *titles = [root nodesForXPath:@&quot;//foo:feed/foo:title&quot; error:&amp;error];
    NSArray *feedTitles = [root nodesForXPath:@&quot;//foo:source/foo:title&quot; error:&amp;error];
    NSArray *feedIds = [root nodesForXPath:@&quot;//foo:source/foo:id&quot; error:&amp;error];
    NSArray *entryTitles = [root nodesForXPath:@&quot;//foo:entry/foo:title&quot; error:&amp;error];
    NSArray *contents = [root nodesForXPath:@&quot;//foo:entry/foo:content&quot; error:&amp;error];
    NSArray *publisheds = [root nodesForXPath:@&quot;//foo:entry/foo:published&quot; error:&amp;error];
&nbsp;
    for (NSUInteger i = 0; i &lt; [feedTitles count]; i++) {
	NSMutableDictionary *result = [[[NSMutableDictionary alloc] init] autorelease];
	[result setObject:[[feedIds objectAtIndex:i] stringValue] forKey:@&quot;feed_id&quot;];
	[result setObject:[[feedTitles objectAtIndex:i] stringValue] forKey:@&quot;feed_title&quot;];
	[result setObject:[[entryTitles objectAtIndex:i] stringValue] forKey:@&quot;entry_title&quot;];	
	[result setObject:[[contents objectAtIndex:i] stringValue] forKey:@&quot;content&quot;];
	[result setObject:[[publisheds objectAtIndex:i] stringValue] forKey:@&quot;published&quot;];		
        [self.objects addObject:result];
    }</pre></td></tr></table></div>

<br />
<br />
NSXMLParserやTouchXMLなどよりもなんだかすっきりできる気がする。<br />
検証はしていないのだけど噂ではTouchXMLよりも高速らしい。<br />
名前もいいし一度お試しあれ。</p>

	<p>タグ: <a href="http://iphone.longearth.net/tag/api/" title="API" rel="tag nofollow">API</a>, <a href="http://iphone.longearth.net/tag/iphone/" title="iphone" rel="tag nofollow">iphone</a>, <a href="http://iphone.longearth.net/tag/kissxml/" title="KissXML" rel="tag nofollow">KissXML</a>, <a href="http://iphone.longearth.net/tag/nsarray/" title="NSArray" rel="tag nofollow">NSArray</a>, <a href="http://iphone.longearth.net/tag/objecti/" title="objecti" rel="tag nofollow">objecti</a>, <a href="http://iphone.longearth.net/tag/objective-c/" title="objective-c" rel="tag nofollow">objective-c</a>, <a href="http://iphone.longearth.net/tag/xcode/" title="Xcode" rel="tag nofollow">Xcode</a>, <a href="http://iphone.longearth.net/tag/xml/" title="XML" rel="tag nofollow">XML</a>, <a href="http://iphone.longearth.net/tag/%e3%81%af%e3%81%a6%e3%81%aa%e3%83%96%e3%83%83%e3%82%af%e3%83%9e%e3%83%bc%e3%82%af/" title="はてなブックマーク" rel="tag nofollow">はてなブックマーク</a>, <a href="http://iphone.longearth.net/tag/%e3%82%a2%e3%83%97%e3%83%aa/" title="アプリ" rel="tag nofollow">アプリ</a>, <a href="http://iphone.longearth.net/tag/%e3%82%ab%e3%83%a1%e3%83%a9/" title="カメラ" rel="tag nofollow">カメラ</a>, <a href="http://iphone.longearth.net/tag/%e3%83%80%e3%82%a6%e3%83%b3%e3%83%ad%e3%83%bc%e3%83%89/" title="ダウンロード" rel="tag nofollow">ダウンロード</a>, <a href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/" title="ライブラリ" rel="tag nofollow">ライブラリ</a>, <a href="http://iphone.longearth.net/tag/%e3%83%aa%e3%82%b9%e3%83%88/" title="リスト" rel="tag nofollow">リスト</a>, <a href="http://iphone.longearth.net/tag/%e9%9f%b3/" title="音" rel="tag nofollow">音</a></p>

	<h4>関連する投稿</h4>
	<ul class="st-related-posts">
	<li><a href="http://iphone.longearth.net/2009/08/16/%e3%80%90iphone%e3%80%91objective-c%e3%81%a7atompub%e3%82%92%e7%b0%a1%e5%8d%98%e3%81%ab%e6%93%8d%e4%bd%9c%e3%81%a7%e3%81%8d%e3%82%8b%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e5%85%ac%e9%96%8b/" title="【iPhone】Objective-CでAtomPubを簡単に操作できるライブラリ公開してみた (2009 年 8 月 16 日)">【iPhone】Objective-CでAtomPubを簡単に操作できるライブラリ公開してみた</a> </li>
	<li><a href="http://iphone.longearth.net/2009/09/01/%e3%80%90iphone%e3%80%91push-notification%e3%81%ae%e5%ae%9f%e8%a3%85%e6%96%b9%e6%b3%95/" title="【iPhone】Push Notificationの実装方法 (2009 年 9 月 1 日)">【iPhone】Push Notificationの実装方法</a> </li>
	<li><a href="http://iphone.longearth.net/2009/06/14/%e3%80%90os3-0%e3%80%91%e3%82%a8%e3%83%aa%e3%82%ab%e6%a7%98%e3%81%ae%e3%82%88%e3%81%86%e3%81%ab%e9%9d%9e%e5%85%ac%e5%bc%8fapi%e3%82%92%e3%83%aa%e3%82%b9%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99/" title="【OS3.0】エリカ様のように非公式APIをリストアップする方法 (2009 年 6 月 14 日)">【OS3.0】エリカ様のように非公式APIをリストアップする方法</a> </li>
	<li><a href="http://iphone.longearth.net/2009/08/09/%e3%80%90xcode%e3%80%91%e8%a8%ad%e5%ae%9a%e3%81%97%e3%81%a6%e3%81%8a%e3%81%8f%e3%81%a8%e4%be%bf%e5%88%a9%e3%81%aa%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%9e%e3%82%a4%e3%82%ba%e3%81%84%e3%82%8d%e3%81%84/" title="【Xcode】設定しておくと便利なカスタマイズいろいろ (2009 年 8 月 9 日)">【Xcode】設定しておくと便利なカスタマイズいろいろ</a> </li>
	<li><a href="http://iphone.longearth.net/2009/01/19/%e3%80%90uitableview%e3%80%91%e9%81%b8%e6%8a%9e%e8%a1%8c%e3%81%8b%e3%82%89%e5%88%a5%e7%94%bb%e9%9d%a2%e3%82%92%e5%91%bc%e3%81%b3%e5%87%ba%e3%81%99/" title="【UITableView】選択行から別画面を呼び出す (2009 年 1 月 19 日)">【UITableView】選択行から別画面を呼び出す</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://iphone.longearth.net/2009/08/12/%e3%80%90iphone%e3%80%91kissxml%e3%81%a7%e5%bf%ab%e9%81%a9%e3%83%91%e3%83%bc%e3%82%b9%e7%94%9f%e6%b4%bb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【iPhone】【Three20】doxygenで神ライブラリのドキュメント生成してみた</title>
		<link>http://iphone.longearth.net/2009/05/22/%e3%80%90iphone%e3%80%91%e3%80%90three20%e3%80%91doxygen%e3%81%a7%e7%a5%9e%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%81%ae%e3%83%89%e3%82%ad%e3%83%a5%e3%83%a1%e3%83%b3%e3%83%88%e7%94%9f%e6%88%90/</link>
		<comments>http://iphone.longearth.net/2009/05/22/%e3%80%90iphone%e3%80%91%e3%80%90three20%e3%80%91doxygen%e3%81%a7%e7%a5%9e%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%81%ae%e3%83%89%e3%82%ad%e3%83%a5%e3%83%a1%e3%83%b3%e3%83%88%e7%94%9f%e6%88%90/#comments</comments>
		<pubDate>Thu, 21 May 2009 15:09:18 +0000</pubDate>
		<dc:creator>daichi</dc:creator>
				<category><![CDATA[開発補助]]></category>
		<category><![CDATA[doxygen]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objecti]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[Three20]]></category>
		<category><![CDATA[UIScrollView]]></category>
		<category><![CDATA[アプリ]]></category>
		<category><![CDATA[ライブラリ]]></category>

		<guid isPermaLink="false">http://iphone.longearth.net/?p=751</guid>
		<description><![CDATA[
iPhoneのPhotoアプリ再現どころではない神ライブラリ見つけた &#124; iphoneアプリで稼げるのか



まだほとんどソースを見切れてないけど、とりあえず全体を流しみるためにも、doxygenを使ってドキュメント [...]]]></description>
			<content:encoded><![CDATA[<p>
<a href="http://iphone.longearth.net/2009/05/14/iphone%e3%81%aephoto%e3%82%a2%e3%83%97%e3%83%aa%e5%86%8d%e7%8f%be%e3%81%a9%e3%81%93%e3%82%8d%e3%81%a7%e3%81%af%e3%81%aa%e3%81%84%e7%a5%9e%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e8%a6%8b%e3%81%a4/">iPhoneのPhotoアプリ再現どころではない神ライブラリ見つけた | iphoneアプリで稼げるのか</a><br />
<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/05/e382afe383a9e382b9-uiview_1242917944406.png"><img class="aligncenter size-medium wp-image-759" title="UIViewから自力で作ってる" src="http://iphone.longearth.net/wp-content/uploads/2009/05/e382afe383a9e382b9-uiview_1242917944406-293x300.png" alt="UIViewから自力で作ってる" width="293" height="300" /></a><br />
<br />
まだほとんどソースを見切れてないけど、とりあえず全体を流しみるためにも、doxygenを使ってドキュメント生成してみた。<br />
<br />
<br />
<a href="http://longearth.sakura.ne.jp/three20-doxygen/html/index.html">Three20ドキュメント</a><br />
（このドキュメント先、一時的に借りてるサーバなので後でURL変わるかも）<br />
<br />
<br />
神ライブラリ。ソース見ればみるほどすごいっす。<br />
Photoビューア部分とかUIScrollViewをうまく使っているのかなと始めは思っていたのですが、UIViewから独自のTTScrollViewを１から作り込んでいたのですね。ん〜なるほどです。<br />
<br />
<span id="more-751"></span><br />
<br />
全体的に見るとAppleが用意しているフレームワーク達と同じようなクラスを独自で作り込んでるっぽい。<br />
ラベルとかビューもスタイルシートクラス用意してバチコンやってるとかすごいなぁ。<br />
<br />
一部日本語が化けてしまうもの（TTSearchLightLabelとか）があったけど、内部でCGContextShowTextAtPointを使っていて、こいつに日本語渡すとうまく表示してくれないみたい。<br />
このへんとか。<br />
<a href="http://iphone-dev.g.hatena.ne.jp/CueNarga/20081027">CGContextShowTextAtPoint で日本語 &#8211; BLUEPALACE.COM iPhone専科 &#8211; iPhoneアプリ開発グループ</a><br />
<br />
結局ここは、<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p751code79'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p75179"><td class="code" id="p751code79"><pre class="objective-c" style="font-family:monospace;">CGContextShowTextAtPoint(context, x, y, [self.text UTF8String], self.text.length);</pre></td></tr></table></div>

<br />
<br />
となっている部分を<br />
<br />

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p751code80'); return false;">View Code</a> OBJECTIVE-C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p75180"><td class="code" id="p751code80"><pre class="objective-c" style="font-family:monospace;">[self.text drawAtPoint:CGPointMake(x,y) withFont:_font];</pre></td></tr></table></div>

<br />
<br />
に置き換えれば表示されるけどなんだかなぁ。Quartzくせが強いっす。<br />
上の方法で日本語表示はほんとにできないのかなぁ。<br />
<br />
多分次回作出すまでは本格的には見れないと思うけどとりあえずこの辺まで。</p>

	<p>タグ: <a href="http://iphone.longearth.net/tag/doxygen/" title="doxygen" rel="tag nofollow">doxygen</a>, <a href="http://iphone.longearth.net/tag/iphone/" title="iphone" rel="tag nofollow">iphone</a>, <a href="http://iphone.longearth.net/tag/objecti/" title="objecti" rel="tag nofollow">objecti</a>, <a href="http://iphone.longearth.net/tag/objective-c/" title="objective-c" rel="tag nofollow">objective-c</a>, <a href="http://iphone.longearth.net/tag/photo/" title="photo" rel="tag nofollow">photo</a>, <a href="http://iphone.longearth.net/tag/three20/" title="Three20" rel="tag nofollow">Three20</a>, <a href="http://iphone.longearth.net/tag/uiscrollview/" title="UIScrollView" rel="tag nofollow">UIScrollView</a>, <a href="http://iphone.longearth.net/tag/%e3%82%a2%e3%83%97%e3%83%aa/" title="アプリ" rel="tag nofollow">アプリ</a>, <a href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/" title="ライブラリ" rel="tag nofollow">ライブラリ</a></p>

	<h4>関連する投稿</h4>
	<ul class="st-related-posts">
	<li><a href="http://iphone.longearth.net/2009/02/15/%e3%80%90iphone%e3%80%91%e7%94%bb%e5%83%8f%e3%82%92%e3%83%95%e3%82%a9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%81%ab%e4%bf%9d%e5%ad%98%e3%81%99%e3%82%8b/" title="【iPhone】画像をフォトライブラリに保存する (2009 年 2 月 15 日)">【iPhone】画像をフォトライブラリに保存する</a> </li>
	<li><a href="http://iphone.longearth.net/2009/07/09/three20%e3%81%a8json-framework%e3%81%a7twitter%e3%81%ae%e3%82%bf%e3%82%a4%e3%83%a0%e3%83%a9%e3%82%a4%e3%83%b3%e7%94%bb%e9%9d%a2%e3%82%92%e4%bd%9c%e3%82%8b/" title="Three20とJSON-FrameworkでTwitterのタイムライン画面を作る (2009 年 7 月 9 日)">Three20とJSON-FrameworkでTwitterのタイムライン画面を作る</a> </li>
	<li><a href="http://iphone.longearth.net/2009/08/09/%e3%80%90xcode%e3%80%91%e8%a8%ad%e5%ae%9a%e3%81%97%e3%81%a6%e3%81%8a%e3%81%8f%e3%81%a8%e4%be%bf%e5%88%a9%e3%81%aa%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%9e%e3%82%a4%e3%82%ba%e3%81%84%e3%82%8d%e3%81%84/" title="【Xcode】設定しておくと便利なカスタマイズいろいろ (2009 年 8 月 9 日)">【Xcode】設定しておくと便利なカスタマイズいろいろ</a> </li>
	<li><a href="http://iphone.longearth.net/2009/06/12/%e3%80%90nsfilemanager%e3%80%91iphone%e5%86%85%e3%81%ae%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e6%8e%a2%e3%81%99/" title="【NSFileManager】iPhone内のファイルを探す (2009 年 6 月 12 日)">【NSFileManager】iPhone内のファイルを探す</a> </li>
	<li><a href="http://iphone.longearth.net/2009/08/07/%e3%80%90iphone%e3%80%91%e3%82%a2%e3%83%97%e3%83%aa%e5%86%85%e3%81%a7web%e3%82%a2%e3%83%97%e3%83%aa%e6%84%9f%e8%a6%9a%e3%81%a7%e7%94%bb%e9%9d%a2%e9%81%b7%e7%a7%bb%e3%81%99%e3%82%8b/" title="【iPhone】アプリ内でWEBアプリ感覚で画面遷移する (2009 年 8 月 7 日)">【iPhone】アプリ内でWEBアプリ感覚で画面遷移する</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://iphone.longearth.net/2009/05/22/%e3%80%90iphone%e3%80%91%e3%80%90three20%e3%80%91doxygen%e3%81%a7%e7%a5%9e%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%81%ae%e3%83%89%e3%82%ad%e3%83%a5%e3%83%a1%e3%83%b3%e3%83%88%e7%94%9f%e6%88%90/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【Three20】をプロジェクトで使えるようにする手順</title>
		<link>http://iphone.longearth.net/2009/05/17/%e3%80%90three20%e3%80%91%e3%82%92%e3%83%97%e3%83%ad%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e3%81%a7%e4%bd%bf%e3%81%88%e3%82%8b%e3%82%88%e3%81%86%e3%81%ab%e3%81%99%e3%82%8b%e6%89%8b%e9%a0%86/</link>
		<comments>http://iphone.longearth.net/2009/05/17/%e3%80%90three20%e3%80%91%e3%82%92%e3%83%97%e3%83%ad%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e3%81%a7%e4%bd%bf%e3%81%88%e3%82%8b%e3%82%88%e3%81%86%e3%81%ab%e3%81%99%e3%82%8b%e6%89%8b%e9%a0%86/#comments</comments>
		<pubDate>Sun, 17 May 2009 04:21:49 +0000</pubDate>
		<dc:creator>daichi</dc:creator>
				<category><![CDATA[開発補助]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[Three20]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[ダウンロード]]></category>
		<category><![CDATA[ライブラリ]]></category>

		<guid isPermaLink="false">http://iphone.longearth.net/?p=704</guid>
		<description><![CDATA[


神ライブラリThree20をプロジェクトで利用する手順。



	Three20をGitHubからダウンロード
	任意の場所に展開（展開場所をTHREE20_HOMEとする）
	{THREE20_HOME}/src [...]]]></description>
			<content:encoded><![CDATA[<p>
<a href="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-20.png"><img class="aligncenter size-medium wp-image-713" title="サンプル" src="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-20-161x300.png" alt="サンプル" width="161" height="300" /></a><br />
<br />
<a href="http://iphone.longearth.net/2009/05/14/iphone%E3%81%AEphoto%E3%82%A2%E3%83%97%E3%83%AA%E5%86%8D%E7%8F%BE%E3%81%A9%E3%81%93%E3%82%8D%E3%81%A7%E3%81%AF%E3%81%AA%E3%81%84%E7%A5%9E%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA%E8%A6%8B%E3%81%A4/">神ライブラリThree20</a>をプロジェクトで利用する手順。<br />
<br />
<span id="more-704"></span><br />
<ol>
	<li>Three20を<a href="http://github.com/joehewitt/three20/tree/master">GitHub</a>からダウンロード</li>
	<li>任意の場所に展開（展開場所をTHREE20_HOMEとする）</li>
	<li>{THREE20_HOME}/src/Three20.xcodeprojをXcodeの「グループとファイル」ペインにドラッグ&amp;ドロップ</li>
	<li>フォルダに項目をコピーのチェックを外し、参照タイプ「プロジェクトを基準」にチェックを外し、追加</li>
<a href="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-15.png"><img class="aligncenter size-medium wp-image-706" title="参照追加" src="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-15-300x281.png" alt="参照追加" width="300" height="281" /></a><br />
	<li>Xcodeメニュー→プロジェクト→アクティブターゲットを{ターゲット名}を編集</li>
	<li>「一般」タブの「直接依存関係」の「+」をクリックし、three20を選択し、追加</li>
<a href="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-17.png"><img class="aligncenter size-medium wp-image-708" title="依存関係追加" src="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-17-300x276.png" alt="依存関係追加" width="300" height="276" /></a><br />
	<li>「ビルド」タブ→構成に「すべての構成」を選択して、「他のリンカフラグ」に「-ObjC」と「-all_load」を設定</li>
	<li>同じく「ビルド」タブで、「ヘッダ検索パス」に{THREE20_HOME}/srcを設定</li>
<a href="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-19.png"><img class="aligncenter size-medium wp-image-710" title="リンカ、パス設定" src="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-19-300x278.png" alt="リンカ、パス設定" width="300" height="278" /></a><br />
画像では/Developer/ExtraLibraries/three20が{THREE20_HOME}になってます<br />
	<li>CoreGrafics.frameworkとQuartzCore.frameworkをプロジェクトに追加</li>
</ol>
以上で完了。<br />
<br />
あとは使いたいところで#import &#8220;Three20/Three20.h&#8221;を書いてやればOK。<br />
<br />
<h4>2009/07/08 追記</h4>
本家の設定手順に変更があったので反映。<br />
「他のリンカフラグ」に「-all_load」を追加</p>

	<p>タグ: <a href="http://iphone.longearth.net/tag/iphone/" title="iphone" rel="tag nofollow">iphone</a>, <a href="http://iphone.longearth.net/tag/photo/" title="photo" rel="tag nofollow">photo</a>, <a href="http://iphone.longearth.net/tag/three20/" title="Three20" rel="tag nofollow">Three20</a>, <a href="http://iphone.longearth.net/tag/xcode/" title="Xcode" rel="tag nofollow">Xcode</a>, <a href="http://iphone.longearth.net/tag/%e3%83%80%e3%82%a6%e3%83%b3%e3%83%ad%e3%83%bc%e3%83%89/" title="ダウンロード" rel="tag nofollow">ダウンロード</a>, <a href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/" title="ライブラリ" rel="tag nofollow">ライブラリ</a></p>

	<h4>関連する投稿</h4>
	<ul class="st-related-posts">
	<li><a href="http://iphone.longearth.net/2009/08/09/%e3%80%90xcode%e3%80%91%e8%a8%ad%e5%ae%9a%e3%81%97%e3%81%a6%e3%81%8a%e3%81%8f%e3%81%a8%e4%be%bf%e5%88%a9%e3%81%aa%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%9e%e3%82%a4%e3%82%ba%e3%81%84%e3%82%8d%e3%81%84/" title="【Xcode】設定しておくと便利なカスタマイズいろいろ (2009 年 8 月 9 日)">【Xcode】設定しておくと便利なカスタマイズいろいろ</a> </li>
	<li><a href="http://iphone.longearth.net/2009/06/14/%e3%80%90os3-0%e3%80%91%e3%82%a8%e3%83%aa%e3%82%ab%e6%a7%98%e3%81%ae%e3%82%88%e3%81%86%e3%81%ab%e9%9d%9e%e5%85%ac%e5%bc%8fapi%e3%82%92%e3%83%aa%e3%82%b9%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%e3%81%99/" title="【OS3.0】エリカ様のように非公式APIをリストアップする方法 (2009 年 6 月 14 日)">【OS3.0】エリカ様のように非公式APIをリストアップする方法</a> </li>
	<li><a href="http://iphone.longearth.net/2009/05/22/%e3%80%90iphone%e3%80%91%e3%80%90three20%e3%80%91doxygen%e3%81%a7%e7%a5%9e%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%81%ae%e3%83%89%e3%82%ad%e3%83%a5%e3%83%a1%e3%83%b3%e3%83%88%e7%94%9f%e6%88%90/" title="【iPhone】【Three20】doxygenで神ライブラリのドキュメント生成してみた (2009 年 5 月 22 日)">【iPhone】【Three20】doxygenで神ライブラリのドキュメント生成してみた</a> </li>
	<li><a href="http://iphone.longearth.net/2009/08/16/%e3%80%90iphone%e3%80%91objective-c%e3%81%a7atompub%e3%82%92%e7%b0%a1%e5%8d%98%e3%81%ab%e6%93%8d%e4%bd%9c%e3%81%a7%e3%81%8d%e3%82%8b%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e5%85%ac%e9%96%8b/" title="【iPhone】Objective-CでAtomPubを簡単に操作できるライブラリ公開してみた (2009 年 8 月 16 日)">【iPhone】Objective-CでAtomPubを簡単に操作できるライブラリ公開してみた</a> </li>
	<li><a href="http://iphone.longearth.net/2009/08/12/%e3%80%90iphone%e3%80%91kissxml%e3%81%a7%e5%bf%ab%e9%81%a9%e3%83%91%e3%83%bc%e3%82%b9%e7%94%9f%e6%b4%bb/" title="【iPhone】KissXMLで快適パース生活 (2009 年 8 月 12 日)">【iPhone】KissXMLで快適パース生活</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://iphone.longearth.net/2009/05/17/%e3%80%90three20%e3%80%91%e3%82%92%e3%83%97%e3%83%ad%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e3%81%a7%e4%bd%bf%e3%81%88%e3%82%8b%e3%82%88%e3%81%86%e3%81%ab%e3%81%99%e3%82%8b%e6%89%8b%e9%a0%86/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>iPhoneのPhotoアプリ再現どころではない神ライブラリ見つけた</title>
		<link>http://iphone.longearth.net/2009/05/14/iphone%e3%81%aephoto%e3%82%a2%e3%83%97%e3%83%aa%e5%86%8d%e7%8f%be%e3%81%a9%e3%81%93%e3%82%8d%e3%81%a7%e3%81%af%e3%81%aa%e3%81%84%e7%a5%9e%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e8%a6%8b%e3%81%a4/</link>
		<comments>http://iphone.longearth.net/2009/05/14/iphone%e3%81%aephoto%e3%82%a2%e3%83%97%e3%83%aa%e5%86%8d%e7%8f%be%e3%81%a9%e3%81%93%e3%82%8d%e3%81%a7%e3%81%af%e3%81%aa%e3%81%84%e7%a5%9e%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e8%a6%8b%e3%81%a4/#comments</comments>
		<pubDate>Wed, 13 May 2009 20:18:32 +0000</pubDate>
		<dc:creator>daichi</dc:creator>
				<category><![CDATA[開発補助]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[Three20]]></category>
		<category><![CDATA[アプリ]]></category>
		<category><![CDATA[キャプチャ]]></category>
		<category><![CDATA[ライセンス]]></category>
		<category><![CDATA[ライブラリ]]></category>
		<category><![CDATA[動画]]></category>

		<guid isPermaLink="false">http://iphone.longearth.net/?p=666</guid>
		<description><![CDATA[
以前見つけたphotoビューザサンプルコードを遥かに凌駕するオープンソースのライブラリを見つけてしまいました。

こんなことが簡単にできてしまう様子。




joehewitt&#8217;s three20 at  [...]]]></description>
			<content:encoded><![CDATA[<p>
以前見つけた<a href="http://github.com/andreyvit/ScrollingMadness/tree/master">photoビューザサンプルコード</a>を遥かに凌駕するオープンソースのライブラリを見つけてしまいました。<br />
<br />
こんなことが簡単にできてしまう様子。<br />
<br />
<a href="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-3.png"><img class="alignleft size-medium wp-image-671" title="かっこいいラベル" src="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-3-161x300.png" alt="かっこいいラベル" width="161" height="300" /></a><a href="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-4.png"><img class="alignleft size-medium wp-image-673" title="photoビューア" src="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-4-161x300.png" alt="photoビューア" width="161" height="300" /></a><a href="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-5.png"><img class="alignleft size-medium wp-image-675" title="photoライブラリ" src="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-5-161x300.png" alt="photoライブラリ" width="161" height="300" /></a><a href="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-6.png"><img class="alignleft size-medium wp-image-677" title="タブコントローラ" src="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-6-161x300.png" alt="タブコントローラ" width="161" height="300" /></a><a href="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-7.png"><img class="alignleft size-medium wp-image-679" title="youtube的なあれ" src="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-7-161x300.png" alt="youtube的なあれ" width="161" height="300" /></a><a href="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-11.png"><img class="alignleft size-medium wp-image-680" title="インクリメンタルなあれ" src="http://iphone.longearth.net/wp-content/uploads/2009/05/e38394e382afe38381e383a3-11-161x300.png" alt="インクリメンタルなあれ" width="161" height="300" /></a><br />
<span id="more-666"></span><br />
<br />
<a href="http://github.com/joehewitt/three20/tree/master">joehewitt&#8217;s three20 at master &#8211; GitHub</a><br />
<br />
iPhoneデフォルトのphotoアプリを再現したスクロールビューを用意している上に、photoビューアコントローラ、photoライブラリ一覧コントローラ、インクリメンタル検索コントローラ、タブコントロール、youtubeの動画一覧のようなtableview(webから画像取得)、待ち受け時のロック解除アニメーションを再現したラベルなど、使えそうなコンポーネントがぎっしり。<br />
<br />
まさに神ライブラリ。<br />
<br />
UICatalog的なサンプルアプリもついているので簡単に動きを確認できます。<br />
<br />
ライセンスはApache License 2.0。<br />
<br />
今まで実現できなかったことがこれのおかげで簡単にできそう。<br />
<br />
いろいろ勉強しつつ、使わせてもらいます。<br />
<br />
あれ？キャプチャ見てて気づいたけどシミュレータでいつの間にか日本語入力できるようになっている！！！ずっと気づいてなかった。。。</p>

	<p>タグ: <a href="http://iphone.longearth.net/tag/iphone/" title="iphone" rel="tag nofollow">iphone</a>, <a href="http://iphone.longearth.net/tag/photo/" title="photo" rel="tag nofollow">photo</a>, <a href="http://iphone.longearth.net/tag/three20/" title="Three20" rel="tag nofollow">Three20</a>, <a href="http://iphone.longearth.net/tag/%e3%82%a2%e3%83%97%e3%83%aa/" title="アプリ" rel="tag nofollow">アプリ</a>, <a href="http://iphone.longearth.net/tag/%e3%82%ad%e3%83%a3%e3%83%97%e3%83%81%e3%83%a3/" title="キャプチャ" rel="tag nofollow">キャプチャ</a>, <a href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%82%bb%e3%83%b3%e3%82%b9/" title="ライセンス" rel="tag nofollow">ライセンス</a>, <a href="http://iphone.longearth.net/tag/%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa/" title="ライブラリ" rel="tag nofollow">ライブラリ</a>, <a href="http://iphone.longearth.net/tag/%e5%8b%95%e7%94%bb/" title="動画" rel="tag nofollow">動画</a></p>

	<h4>関連する投稿</h4>
	<ul class="st-related-posts">
	<li><a href="http://iphone.longearth.net/2009/05/22/%e3%80%90iphone%e3%80%91%e3%80%90three20%e3%80%91doxygen%e3%81%a7%e7%a5%9e%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%81%ae%e3%83%89%e3%82%ad%e3%83%a5%e3%83%a1%e3%83%b3%e3%83%88%e7%94%9f%e6%88%90/" title="【iPhone】【Three20】doxygenで神ライブラリのドキュメント生成してみた (2009 年 5 月 22 日)">【iPhone】【Three20】doxygenで神ライブラリのドキュメント生成してみた</a> </li>
	<li><a href="http://iphone.longearth.net/2009/05/17/%e3%80%90three20%e3%80%91%e3%82%92%e3%83%97%e3%83%ad%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e3%81%a7%e4%bd%bf%e3%81%88%e3%82%8b%e3%82%88%e3%81%86%e3%81%ab%e3%81%99%e3%82%8b%e6%89%8b%e9%a0%86/" title="【Three20】をプロジェクトで使えるようにする手順 (2009 年 5 月 17 日)">【Three20】をプロジェクトで使えるようにする手順</a> </li>
	<li><a href="http://iphone.longearth.net/2009/05/29/%e3%80%90mac%e3%80%91%e9%96%8b%e7%99%ba%e4%b8%ad%e3%81%ae%e3%82%a2%e3%83%97%e3%83%aa%e3%82%92%e5%85%88%e8%a1%8c%e5%85%ac%e9%96%8b%e3%81%99%e3%82%8b%e6%99%82%e3%81%ab%e4%bd%bf%e3%81%88%e3%81%9d/" title="【mac】開発中のアプリを先行公開する時に使えそうなフリーの動画キャプチャソフト (2009 年 5 月 29 日)">【mac】開発中のアプリを先行公開する時に使えそうなフリーの動画キャプチャソフト</a> </li>
	<li><a href="http://iphone.longearth.net/2009/02/15/%e3%80%90iphone%e3%80%91%e7%94%bb%e5%83%8f%e3%82%92%e3%83%95%e3%82%a9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%81%ab%e4%bf%9d%e5%ad%98%e3%81%99%e3%82%8b/" title="【iPhone】画像をフォトライブラリに保存する (2009 年 2 月 15 日)">【iPhone】画像をフォトライブラリに保存する</a> </li>
	<li><a href="http://iphone.longearth.net/2009/08/16/%e3%80%90iphone%e3%80%91objective-c%e3%81%a7atompub%e3%82%92%e7%b0%a1%e5%8d%98%e3%81%ab%e6%93%8d%e4%bd%9c%e3%81%a7%e3%81%8d%e3%82%8b%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e5%85%ac%e9%96%8b/" title="【iPhone】Objective-CでAtomPubを簡単に操作できるライブラリ公開してみた (2009 年 8 月 16 日)">【iPhone】Objective-CでAtomPubを簡単に操作できるライブラリ公開してみた</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://iphone.longearth.net/2009/05/14/iphone%e3%81%aephoto%e3%82%a2%e3%83%97%e3%83%aa%e5%86%8d%e7%8f%be%e3%81%a9%e3%81%93%e3%82%8d%e3%81%a7%e3%81%af%e3%81%aa%e3%81%84%e7%a5%9e%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e8%a6%8b%e3%81%a4/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
