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

<channel>
	<title>虎視眈々 &#187; iOS</title>
	<atom:link href="http://seiichirou.jp/category/ios/feed/" rel="self" type="application/rss+xml" />
	<link>http://seiichirou.jp</link>
	<description>主にiPhoneアプリ開発のこと。iOSや開発メモや備忘録。</description>
	<lastBuildDate>Wed, 18 Apr 2012 06:25:52 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>iPhoneアプリをXcodeで開発中に急にインストールできなくなった場合</title>
		<link>http://seiichirou.jp/2011/05/16/iphone%e3%82%a2%e3%83%97%e3%83%aa%e3%82%92xcode%e3%81%a7%e9%96%8b%e7%99%ba%e4%b8%ad%e3%81%ab%e6%80%a5%e3%81%ab%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%8f/</link>
		<comments>http://seiichirou.jp/2011/05/16/iphone%e3%82%a2%e3%83%97%e3%83%aa%e3%82%92xcode%e3%81%a7%e9%96%8b%e7%99%ba%e4%b8%ad%e3%81%ab%e6%80%a5%e3%81%ab%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%8f/#comments</comments>
		<pubDate>Mon, 16 May 2011 12:58:12 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=625</guid>
		<description><![CDATA[<p>XcodeでiPhoneアプリの開発中に急にこんなメッセージが出てアプリが起動できない状態になった。 iPhoneを再起動したら直った。 いつの間にかiPhoneの状態に問題が出てたのかな。 iPhoneアプリをXcodeで開発中に急にインストールできなくなった場合 is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/05/16/iphone%e3%82%a2%e3%83%97%e3%83%aa%e3%82%92xcode%e3%81%a7%e9%96%8b%e7%99%ba%e4%b8%ad%e3%81%ab%e6%80%a5%e3%81%ab%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%8f/">iPhoneアプリをXcodeで開発中に急にインストールできなくなった場合</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<p>XcodeでiPhoneアプリの開発中に急にこんなメッセージが出てアプリが起動できない状態になった。</p>
<p></p><pre class="crayon-plain-tag">Couldn't register xxx.xxxxxx.xxxxxx with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).</pre><p></p>
<p>iPhoneを再起動したら直った。<br />
いつの間にかiPhoneの状態に問題が出てたのかな。</p>
<p><a href="http://seiichirou.jp/2011/05/16/iphone%e3%82%a2%e3%83%97%e3%83%aa%e3%82%92xcode%e3%81%a7%e9%96%8b%e7%99%ba%e4%b8%ad%e3%81%ab%e6%80%a5%e3%81%ab%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%8f/">iPhoneアプリをXcodeで開発中に急にインストールできなくなった場合</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/05/16/iphone%e3%82%a2%e3%83%97%e3%83%aa%e3%82%92xcode%e3%81%a7%e9%96%8b%e7%99%ba%e4%b8%ad%e3%81%ab%e6%80%a5%e3%81%ab%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%8f/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>『Audio帳（仮）』開発　その５　NavigationBarの背景色</title>
		<link>http://seiichirou.jp/2011/05/07/%e3%80%8eaudio%e5%b8%b3%ef%bc%88%e4%bb%ae%ef%bc%89%e3%80%8f%e9%96%8b%e7%99%ba%e3%80%80%e3%81%9d%e3%81%ae%ef%bc%95%e3%80%80navigationbar%e3%81%ae%e8%83%8c%e6%99%af%e8%89%b2/</link>
		<comments>http://seiichirou.jp/2011/05/07/%e3%80%8eaudio%e5%b8%b3%ef%bc%88%e4%bb%ae%ef%bc%89%e3%80%8f%e9%96%8b%e7%99%ba%e3%80%80%e3%81%9d%e3%81%ae%ef%bc%95%e3%80%80navigationbar%e3%81%ae%e8%83%8c%e6%99%af%e8%89%b2/#comments</comments>
		<pubDate>Sat, 07 May 2011 14:02:19 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[Audio帳]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[tintColor]]></category>
		<category><![CDATA[UIColor]]></category>
		<category><![CDATA[UINavigationController]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=584</guid>
		<description><![CDATA[<p>NavigationBarの背景色を好きなものに変える UINavigationControllerのNavigationBarは背景色を自由にかえることができる。 アプリに合った色にすると見栄えも良くなるだろうか。 取りあえず仮で色を変えておく。 NavigationControllerを作っている所で変えておこう。このアプリではAppDelegateのところ。 こんな色になった。 背景を画像にすることもできるらしいが、今の所はこれで進めよう。 『Audio帳（仮）』開発　その５　NavigationBarの背景色 is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/05/07/%e3%80%8eaudio%e5%b8%b3%ef%bc%88%e4%bb%ae%ef%bc%89%e3%80%8f%e9%96%8b%e7%99%ba%e3%80%80%e3%81%9d%e3%81%ae%ef%bc%95%e3%80%80navigationbar%e3%81%ae%e8%83%8c%e6%99%af%e8%89%b2/">『Audio帳（仮）』開発　その５　NavigationBarの背景色</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<h4>NavigationBarの背景色を好きなものに変える</h4>
<p>UINavigationControllerのNavigationBarは背景色を自由にかえることができる。</p>
<p>アプリに合った色にすると見栄えも良くなるだろうか。</p>
<p>取りあえず仮で色を変えておく。</p>
<p>NavigationControllerを作っている所で変えておこう。このアプリではAppDelegateのところ。</p><pre class="crayon-plain-tag">- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [super application:application didFinishLaunchingWithOptions:launchOptions];

    AlbumListViewController *controller = [[[AlbumListViewController alloc]init]autorelease];
    UINavigationController *navigationController = [[[UINavigationController alloc]initWithRootViewController:controller]autorelease];

    navigationController.navigationBar.barStyle = UIBarStyleBlack;
    // NavigationBarの色を変える
    // 今は適当に#CF5B6Fにしておく
    navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.761 green:0.333 blue:0.408 alpha:1.0];
    navigationController.toolbar.barStyle = UIBarStyleBlack;

    self.window.rootViewController = navigationController;

    return YES;
}</pre><p><span id="more-584"></span></p>
<p>こんな色になった。<br />
<a href="http://seiichirou.jp/wp-content/uploads/2011/05/IMG_0335.png"><img class="alignnone size-medium wp-image-585" title="IMG_0335" src="http://seiichirou.jp/wp-content/uploads/2011/05/IMG_0335-200x300.png" alt="" width="200" height="300" /></a><br />
背景を画像にすることもできるらしいが、今の所はこれで進めよう。</p>
<p><a href="http://seiichirou.jp/2011/05/07/%e3%80%8eaudio%e5%b8%b3%ef%bc%88%e4%bb%ae%ef%bc%89%e3%80%8f%e9%96%8b%e7%99%ba%e3%80%80%e3%81%9d%e3%81%ae%ef%bc%95%e3%80%80navigationbar%e3%81%ae%e8%83%8c%e6%99%af%e8%89%b2/">『Audio帳（仮）』開発　その５　NavigationBarの背景色</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/05/07/%e3%80%8eaudio%e5%b8%b3%ef%bc%88%e4%bb%ae%ef%bc%89%e3%80%8f%e9%96%8b%e7%99%ba%e3%80%80%e3%81%9d%e3%81%ae%ef%bc%95%e3%80%80navigationbar%e3%81%ae%e8%83%8c%e6%99%af%e8%89%b2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>オーディオブックのアルバムの一覧を表示してみる</title>
		<link>http://seiichirou.jp/2011/04/15/%e3%82%aa%e3%83%bc%e3%83%87%e3%82%a3%e3%82%aa%e3%83%96%e3%83%83%e3%82%af%e3%81%ae%e3%82%a2%e3%83%ab%e3%83%90%e3%83%a0%e3%81%ae%e4%b8%80%e8%a6%a7%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%97%e3%81%a6%e3%81%bf/</link>
		<comments>http://seiichirou.jp/2011/04/15/%e3%82%aa%e3%83%bc%e3%83%87%e3%82%a3%e3%82%aa%e3%83%96%e3%83%83%e3%82%af%e3%81%ae%e3%82%a2%e3%83%ab%e3%83%90%e3%83%a0%e3%81%ae%e4%b8%80%e8%a6%a7%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%97%e3%81%a6%e3%81%bf/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 17:26:03 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[Audio帳]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[MediaPlayer]]></category>
		<category><![CDATA[MPMediaGroupingAlbum]]></category>
		<category><![CDATA[MPMediaItem]]></category>
		<category><![CDATA[MPMediaItemCollection]]></category>
		<category><![CDATA[MPMediaQuery]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=512</guid>
		<description><![CDATA[<p>Audio帳(仮)を作るために、iPodのオーディオブックへのアクセスを試してみる。 とりあえず、TableViewにオーディオブックの一覧を表示をやってみる。 まず前提として 「MediaPlayer.framework」ライブラリをリンクしていること TableViewControllerを継承したControllerを作る。アルバムのコレクションを維持するNSArrayを持っておく。 MediaPlayer.hをimportして、MPMediaQueryを利用してアルバムの一覧をゲットする関数を作っておく。 あとはアルバムをTableViewに表示だけ。 こんな感じになった。 DUO3.0を例文毎に分割したものもあるのでDUO3.0のアルバムが二つある。 アルバムやアーティストが設定されていないオーディオは空になっているようなので、それは「不明な〜」に置き換えて表示しておく。 オーディオブックのアルバムの一覧を表示してみる is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/04/15/%e3%82%aa%e3%83%bc%e3%83%87%e3%82%a3%e3%82%aa%e3%83%96%e3%83%83%e3%82%af%e3%81%ae%e3%82%a2%e3%83%ab%e3%83%90%e3%83%a0%e3%81%ae%e4%b8%80%e8%a6%a7%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%97%e3%81%a6%e3%81%bf/">オーディオブックのアルバムの一覧を表示してみる</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Audio帳(仮)を作るために、iPodのオーディオブックへのアクセスを試してみる。</p>
<p>とりあえず、TableViewにオーディオブックの一覧を表示をやってみる。</p>
<p>まず前提として</p>
<ul>
<li>「MediaPlayer.framework」ライブラリをリンクしていること</li>
</ul>
<p>TableViewControllerを継承したControllerを作る。アルバムのコレクションを維持するNSArrayを持っておく。</p>
<p></p><pre class="crayon-plain-tag">#import &amp;lt;UIKit/UIKit.h&amp;gt;

@interface AlbumViewController : UITableViewController {
@private
    NSArray *_albums;
}

@property(nonatomic, retain) NSArray *albums;

@end</pre><p><span id="more-512"></span></pre>
<p>MediaPlayer.hをimportして、MPMediaQueryを利用してアルバムの一覧をゲットする関数を作っておく。</p>
<p></p><pre class="crayon-plain-tag">#import &amp;lt;MediaPlayer/MediaPlayer.h&amp;gt;

@implementation AlbumViewController

@synthesize albums=_albums;

- (void)updateAlbums
{
    // オーディオブックのクエリのみをゲット
    MPMediaQuery *query = [MPMediaQuery audiobooksQuery];
    // アルバムの一覧が欲しいので、グルーピングはアルバムにする
    [query setGroupingType: MPMediaGroupingAlbum];
    // コレクションをとっとく
    self.albums = [query collections];
}</pre><p></p>
<p>あとはアルバムをTableViewに表示だけ。</p>
<p></p><pre class="crayon-plain-tag">- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // セクションは1で固定しとく
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // アルバム数を返す
    return self.albums.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @&amp;quot;Cell&amp;quot;;
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        // サブタイトル付きのセル
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    }

    // アルバムをげっと
    MPMediaItemCollection *album = [self.albums objectAtIndex:indexPath.row];
    // アルバム情報
    MPMediaItem *representativeItem = [album representativeItem];

    // タイトルを表示
    cell.textLabel.text = [representativeItem valueForProperty: MPMediaItemPropertyAlbumTitle];
    if ([cell.textLabel.text isEqualToString:@&amp;quot;&amp;quot;]) {
        cell.textLabel.text = @&amp;quot;不明なアルバム&amp;quot;;
    }
    // アーティストを表示
    cell.detailTextLabel.text = [representativeItem valueForProperty: MPMediaItemPropertyArtist];
    if ([cell.detailTextLabel.text isEqualToString:@&amp;quot;&amp;quot;]) {
        cell.detailTextLabel.text = @&amp;quot;不明な作成者&amp;quot;;
    }

    return cell;
}</pre><p></p>
<p>こんな感じになった。<br />
<a href="http://seiichirou.jp/wp-content/uploads/2011/04/IMG_0223.png"><img class="alignnone size-medium wp-image-519" title="IMG_0223" src="http://seiichirou.jp/wp-content/uploads/2011/04/IMG_0223-200x300.png" alt="" width="200" height="300" /></a><br />
DUO3.0を例文毎に分割したものもあるのでDUO3.0のアルバムが二つある。<br />
アルバムやアーティストが設定されていないオーディオは空になっているようなので、それは「不明な〜」に置き換えて表示しておく。</p>
<p><a href="http://seiichirou.jp/2011/04/15/%e3%82%aa%e3%83%bc%e3%83%87%e3%82%a3%e3%82%aa%e3%83%96%e3%83%83%e3%82%af%e3%81%ae%e3%82%a2%e3%83%ab%e3%83%90%e3%83%a0%e3%81%ae%e4%b8%80%e8%a6%a7%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%97%e3%81%a6%e3%81%bf/">オーディオブックのアルバムの一覧を表示してみる</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/04/15/%e3%82%aa%e3%83%bc%e3%83%87%e3%82%a3%e3%82%aa%e3%83%96%e3%83%83%e3%82%af%e3%81%ae%e3%82%a2%e3%83%ab%e3%83%90%e3%83%a0%e3%81%ae%e4%b8%80%e8%a6%a7%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%97%e3%81%a6%e3%81%bf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UIViewに図形を直接描画する</title>
		<link>http://seiichirou.jp/2011/03/08/uiview%e3%81%ab%e5%9b%b3%e5%bd%a2%e3%82%92%e7%9b%b4%e6%8e%a5%e6%8f%8f%e7%94%bb%e3%81%99%e3%82%8b/</link>
		<comments>http://seiichirou.jp/2011/03/08/uiview%e3%81%ab%e5%9b%b3%e5%bd%a2%e3%82%92%e7%9b%b4%e6%8e%a5%e6%8f%8f%e7%94%bb%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 14:52:30 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[CGContext]]></category>
		<category><![CDATA[CGContextAddArcToPoint]]></category>
		<category><![CDATA[UIGraphicsGetCurrentContext]]></category>
		<category><![CDATA[UIView]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=375</guid>
		<description><![CDATA[<p>UIViewに直接図形を描画するにはコンテキストを使う。 CGContextをゲットして、それに対して図形を描いていく。 今回はUIViewのdrawRectメソッドをオーバーライドして描画してみる。 上のコードを実装したUIViewを正方形で設置するとこんな風に表示がされる。 ついでにこれを使ってUIViewControllerでアニメーションを実装してみる。 以下のコードを実装する。 放っておくと虹が消えて、タッチをすると虹がまた現れる。 UIViewに図形を直接描画する is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/03/08/uiview%e3%81%ab%e5%9b%b3%e5%bd%a2%e3%82%92%e7%9b%b4%e6%8e%a5%e6%8f%8f%e7%94%bb%e3%81%99%e3%82%8b/">UIViewに図形を直接描画する</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<p>UIViewに直接図形を描画するにはコンテキストを使う。</p>
<p>CGContextをゲットして、それに対して図形を描いていく。</p>
<p>今回はUIViewのdrawRectメソッドをオーバーライドして描画してみる。</p>
<p><span id="more-375"></span></p>
<p></p><pre class="crayon-plain-tag">- (id)initWithFrame:(CGRect)frame {

    self = [super initWithFrame:frame];
    if (self) {
        // 背景色を透明に
        self.backgroundColor = UIColor.clearColor;
    }
    return self;
}

/**
 * UIViewを描画する時に呼ばれる
 */
- (void)drawRect:(CGRect)rect {
    [super drawRect:rect];

    // ６色
    UIColor *colors[6] = {
        UIColor.redColor,
        UIColor.orangeColor,
        UIColor.yellowColor,
        UIColor.greenColor,
        UIColor.blueColor,
        UIColor.purpleColor,
    };

    CGRect r = self.bounds;
    int width = 20;
    int offset = 10;

    // コンテキストをゲット
    CGContextRef context = UIGraphicsGetCurrentContext();
    // 線の幅を設定
    CGContextSetLineWidth(context, width);
    for (int i = 0; i &amp;lt; 6; i++) {
        // 線の色を設定
        CGContextSetStrokeColorWithColor(context, colors[i].CGColor);
        // 書き出し位置に移動
        CGContextMoveToPoint(context, offset, r.size.height);
        // 弧の位置を設定
        CGContextAddArcToPoint(context, offset, offset, r.size.width, offset, r.size.width - offset);
        // パスを描画
        CGContextStrokePath(context);
        offset += width;
    }
}</pre><p></p>
<p>上のコードを実装したUIViewを正方形で設置するとこんな風に表示がされる。</p>
<p><a href="http://seiichirou.jp/wp-content/uploads/2011/03/IMG_0162.png"><img class="alignnone size-medium wp-image-377" title="IMG_0162" src="http://seiichirou.jp/wp-content/uploads/2011/03/IMG_0162-200x300.png" alt="" width="200" height="300" /></a></p>
<p>ついでにこれを使ってUIViewControllerでアニメーションを実装してみる。</p>
<p>以下のコードを実装する。</p>
<p></p><pre class="crayon-plain-tag">/**
 * 虹をフェードアウトさせる
 * 1.２秒待って
 * 2.２秒かけて透明度を0にする
 */
- (void)fadeoutView {
    // アニメーション設定開始
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:2.0];
    [UIView setAnimationDelay:2.0];
    // 透明度0
    _rainbowView.alpha = 0.0;
    // アニメーションをコミット
    [UIView commitAnimations];
}

/**
 * 虹を表示させる
 * 1.透明度を1にもどす
 */
- (void)resetView {
    // 透明度を戻す
    _rainbowView.alpha = 1.0;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = UIColor.whiteColor;

    // 正方形で下に設置する
    CGRect rect = self.view.bounds;
    rect.origin.y = rect.size.height - rect.size.width;
    rect.size.height = rect.size.width;
    _rainbowView = [[RainbowView alloc] initWithFrame:rect];
    [self.view addSubview:_rainbowView];
    [self fadeoutView];
}

- (void)viewDidUnload {
    [super viewDidUnload];
}

- (void)dealloc {
    [_rainbowView release];
    [super dealloc];
}

/**
 * タッチイベント開始
 */
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:touches withEvent:event];
    // 虹を表示する
    [self resetView];
}

/**
 * タッチ移動
 */
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    [super touchesMoved:touches withEvent:event];
}

/**
 * タッチイベント終了
 */
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    [super touchesEnded:touches withEvent:event];
    // 虹をフェードアウトする
    [self fadeoutView];
}</pre><p></p>
<p>放っておくと虹が消えて、タッチをすると虹がまた現れる。</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/zcFqNQ-FEaM?hl=ja&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="550" height="400" src="http://www.youtube.com/v/zcFqNQ-FEaM?hl=ja&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><a href="http://seiichirou.jp/2011/03/08/uiview%e3%81%ab%e5%9b%b3%e5%bd%a2%e3%82%92%e7%9b%b4%e6%8e%a5%e6%8f%8f%e7%94%bb%e3%81%99%e3%82%8b/">UIViewに図形を直接描画する</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/03/08/uiview%e3%81%ab%e5%9b%b3%e5%bd%a2%e3%82%92%e7%9b%b4%e6%8e%a5%e6%8f%8f%e7%94%bb%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UIToolbarのアイテム（ボタン）を切り替える</title>
		<link>http://seiichirou.jp/2011/03/07/uitoolbar%e3%81%ae%e3%82%a2%e3%82%a4%e3%83%86%e3%83%a0%ef%bc%88%e3%83%9c%e3%82%bf%e3%83%b3%ef%bc%89%e3%82%92%e5%88%87%e3%82%8a%e6%9b%bf%e3%81%88%e3%82%8b/</link>
		<comments>http://seiichirou.jp/2011/03/07/uitoolbar%e3%81%ae%e3%82%a2%e3%82%a4%e3%83%86%e3%83%a0%ef%bc%88%e3%83%9c%e3%82%bf%e3%83%b3%ef%bc%89%e3%82%92%e5%88%87%e3%82%8a%e6%9b%bf%e3%81%88%e3%82%8b/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 13:35:39 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[UIBarButtonItem]]></category>
		<category><![CDATA[UIToolbar]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=372</guid>
		<description><![CDATA[<p>UIToolbarのアイテムを状況によって切り替えたい時がある。 そんな時はUIToolbarのsetItemをまた呼び出せばいい。 以下がサンプルコード。 setItemのanimatedをYESで呼び出せば、フェードアウト、フェードインのアニメーションで切り替えてくれる。 UIToolbarのアイテム（ボタン）を切り替える is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/03/07/uitoolbar%e3%81%ae%e3%82%a2%e3%82%a4%e3%83%86%e3%83%a0%ef%bc%88%e3%83%9c%e3%82%bf%e3%83%b3%ef%bc%89%e3%82%92%e5%88%87%e3%82%8a%e6%9b%bf%e3%81%88%e3%82%8b/">UIToolbarのアイテム（ボタン）を切り替える</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<p>UIToolbarのアイテムを状況によって切り替えたい時がある。</p>
<p>そんな時はUIToolbarのsetItemをまた呼び出せばいい。</p>
<p>以下がサンプルコード。</p>
<p><span id="more-372"></span></p>
<p></p><pre class="crayon-plain-tag">/**
 * Toolbarのボタン１軍
 */
- (void)setBarButtonItems1 {
    UIBarButtonItem *barButtonItem1 =
    [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCompose
                                                  target:self
                                                  action:@selector(buttonEvent1:)]autorelease];
    UIBarButtonItem *barButtonItem2 =
    [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemReply
                                                  target:self
                                                  action:@selector(buttonEvent1:)]autorelease];
    UIBarButtonItem *barButtonItem3 =
    [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                  target:self
                                                  action:@selector(buttonEvent1:)]autorelease];
    UIBarButtonItem *barButtonItem4 =
    [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemOrganize
                                                  target:self
                                                  action:@selector(buttonEvent1:)]autorelease];
    UIBarButtonItem *barButtonItem5 =
    [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                  target:self
                                                  action:@selector(buttonEvent1:)]autorelease];

    // animated:YESでItemを設定する
    [_toolBar setItems:
     [NSArray arrayWithObjects:barButtonItem1, barButtonItem2, barButtonItem3, barButtonItem4, barButtonItem5, nil]
              animated:YES];
}

/**
 * Toolbarのボタン２軍
 */
- (void)setBarButtonItems2 {
    UIBarButtonItem *barButtonItem1 =
    [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSearch
                                                  target:self
                                                  action:@selector(buttonEvent2:)]autorelease];
    UIBarButtonItem *barButtonItem2 =
    [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                  target:self
                                                  action:@selector(buttonEvent2:)]autorelease];
    UIBarButtonItem *barButtonItem3 =
    [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemStop
                                                  target:self
                                                  action:@selector(buttonEvent2:)]autorelease];
    UIBarButtonItem *barButtonItem4 =
    [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCamera
                                                  target:self
                                                  action:@selector(buttonEvent2:)]autorelease];
    UIBarButtonItem *barButtonItem5 =
    [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemTrash
                                                  target:self
                                                  action:@selector(buttonEvent2:)]autorelease];

    // animated:YESでItemを設定する
    [_toolBar setItems:
     [NSArray arrayWithObjects:barButtonItem1, barButtonItem2, barButtonItem3, barButtonItem4, barButtonItem5, nil]
              animated:YES];
}

/**
 * １軍のボタンが押されたときのアクション
 */
- (void)buttonEvent1:(id)sender {
    // Toolbarのアイテムを２軍に変える
    [self setBarButtonItems2];
}

/**
 * ２軍のボタンが押されたときのアクション
 */
- (void)buttonEvent2:(id)sender {
    // Toolbarのアイテムを１軍に変える
    [self setBarButtonItems1];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];

    // Toolbarの初期化
    _toolBar = [[[UIToolbar alloc]init]autorelease];
    _toolBar.barStyle = UIBarStyleBlackTranslucent;
    [_toolBar setFrame:CGRectMake(0, 416, self.view.bounds.size.width, 44)];

    // サブビューに追加
    [self.view addSubview:_toolBar];

    // 最初は１軍に設定する
    [self setBarButtonItems1];
}</pre><p></p>
<p>setItemのanimatedをYESで呼び出せば、フェードアウト、フェードインのアニメーションで切り替えてくれる。</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/9vjBzbgoL9U?hl=ja&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="550" height="400" src="http://www.youtube.com/v/9vjBzbgoL9U?hl=ja&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><a href="http://seiichirou.jp/2011/03/07/uitoolbar%e3%81%ae%e3%82%a2%e3%82%a4%e3%83%86%e3%83%a0%ef%bc%88%e3%83%9c%e3%82%bf%e3%83%b3%ef%bc%89%e3%82%92%e5%88%87%e3%82%8a%e6%9b%bf%e3%81%88%e3%82%8b/">UIToolbarのアイテム（ボタン）を切り替える</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/03/07/uitoolbar%e3%81%ae%e3%82%a2%e3%82%a4%e3%83%86%e3%83%a0%ef%bc%88%e3%83%9c%e3%82%bf%e3%83%b3%ef%bc%89%e3%82%92%e5%88%87%e3%82%8a%e6%9b%bf%e3%81%88%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UIViewをタッチイベントで回転させる</title>
		<link>http://seiichirou.jp/2011/03/04/uiview%e3%82%92%e3%82%bf%e3%83%83%e3%83%81%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88%e3%81%a7%e5%9b%9e%e8%bb%a2%e3%81%95%e3%81%9b%e3%82%8b/</link>
		<comments>http://seiichirou.jp/2011/03/04/uiview%e3%82%92%e3%82%bf%e3%83%83%e3%83%81%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88%e3%81%a7%e5%9b%9e%e8%bb%a2%e3%81%95%e3%81%9b%e3%82%8b/#comments</comments>
		<pubDate>Thu, 03 Mar 2011 16:24:13 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[CGAffineTransformRotate]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[UIView]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=344</guid>
		<description><![CDATA[<p>今度はタッチイベントで、タッチした後に指を動かしたら画像が回転するように作ってみる。 タッチの移動はtouchesMovedで検知できる。 UIViewに以下のようなコードを実装して、 動かした結果がこれ。 今度作ってみるアプリでもViewをタッチで回転する必要がありそうだからもうちょっと調べねば。 UIViewをタッチイベントで回転させる is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/03/04/uiview%e3%82%92%e3%82%bf%e3%83%83%e3%83%81%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88%e3%81%a7%e5%9b%9e%e8%bb%a2%e3%81%95%e3%81%9b%e3%82%8b/">UIViewをタッチイベントで回転させる</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<p>今度はタッチイベントで、タッチした後に指を動かしたら画像が回転するように作ってみる。</p>
<p>タッチの移動はtouchesMovedで検知できる。</p>
<p>UIViewに以下のようなコードを実装して、</p>
<p><span id="more-344"></span></p>
<p></p><pre class="crayon-plain-tag">/**
 * タッチイベント開始
 */
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    // 最初のタッチ地点を取っておく
    lastPoint = [[touches anyObject] locationInView:self.superview];
}

/**
 * タッチ移動
 */
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    // タッチされている座標をゲット
    CGPoint p = [[touches anyObject] locationInView:self.superview];

    // 角度を計算
    CGFloat ax = (lastPoint.x - self.center.x);
    CGFloat ay = (lastPoint.y - self.center.y);
    CGFloat bx = (p.x - self.center.x);
    CGFloat by = (p.y - self.center.y);

    // ラジアンをゲット
    CGFloat r = atan2(ax * by - ay * bx, ax * bx + ay * by);

    // アニメーション設定開始
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.05];
    // 回転
    self.transform = CGAffineTransformRotate(self.transform, r);
    // アニメーションをコミット
    [UIView commitAnimations];

    // 今回の座標が次のイベントの時の起点になるので更新しておく
    lastPoint = p;
}

/**
 * タッチイベント終了
 */
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
}</pre><p></p>
<p>動かした結果がこれ。</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/KF7mc2t2fCw?hl=ja&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="550" height="400" src="http://www.youtube.com/v/KF7mc2t2fCw?hl=ja&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>今度作ってみるアプリでもViewをタッチで回転する必要がありそうだからもうちょっと調べねば。</p>
<p><a href="http://seiichirou.jp/2011/03/04/uiview%e3%82%92%e3%82%bf%e3%83%83%e3%83%81%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88%e3%81%a7%e5%9b%9e%e8%bb%a2%e3%81%95%e3%81%9b%e3%82%8b/">UIViewをタッチイベントで回転させる</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/03/04/uiview%e3%82%92%e3%82%bf%e3%83%83%e3%83%81%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88%e3%81%a7%e5%9b%9e%e8%bb%a2%e3%81%95%e3%81%9b%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UIViewのタッチイベントとAnimationを試してみる</title>
		<link>http://seiichirou.jp/2011/03/01/uiview%e3%81%ae%e3%82%bf%e3%83%83%e3%83%81%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88%e3%81%a8coreanimation%e3%82%92%e8%a9%a6%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/</link>
		<comments>http://seiichirou.jp/2011/03/01/uiview%e3%81%ae%e3%82%bf%e3%83%83%e3%83%81%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88%e3%81%a8coreanimation%e3%82%92%e8%a9%a6%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 17:04:46 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[CGAffineTransform]]></category>
		<category><![CDATA[CGAffineTransformConcat]]></category>
		<category><![CDATA[CGAffineTransformMakeScale]]></category>
		<category><![CDATA[CGAffineTransformMakeTranslation]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[UIView]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=333</guid>
		<description><![CDATA[<p>iOSではタッチイベントやUser Interfaceを派手にするためのAnimationを簡単に実装できるとのこと。 それを試してみる。 UIViewを継承したクラスにタッチイベントを実装する。今回は画像を読み込んでそれを表示するViewにする。 touchesBeganとthouchesEndedを追加するだけ。 次はタッチイベント内でアニメーションを設定する。 画像がタッチされたらその画像が画面いっぱいに拡大されるアニメーションを設定する。画面中段に複数の画像が敷き詰められた状況を想定する。 あとは、UIViewControllerでこのUIViewをサブビューとして追加していけばいい。 実装した結果がこんな感じ。 動作は軽快。ぬるぬる動いてる。 色んなことができそうな予感がする。 UIViewのタッチイベントとAnimationを試してみる is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/03/01/uiview%e3%81%ae%e3%82%bf%e3%83%83%e3%83%81%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88%e3%81%a8coreanimation%e3%82%92%e8%a9%a6%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/">UIViewのタッチイベントとAnimationを試してみる</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<p>iOSではタッチイベントやUser Interfaceを派手にするためのAnimationを簡単に実装できるとのこと。</p>
<p>それを試してみる。</p>
<p>UIViewを継承したクラスにタッチイベントを実装する。今回は画像を読み込んでそれを表示するViewにする。</p>
<p><span id="more-333"></span></p>
<p></p><pre class="crayon-plain-tag">/**
 * フレームサイズと画像リソース名で初期化する
 * 画像リソース名でUIImageViewを作り、同サイズでサブビューとする
 */
- (id)initWithFrame:(CGRect)frame withImageNamed:(NSString*)imageNamed {
    self = [super initWithFrame:frame];
    if (self) {
        UIImageView *imageView = [[[UIImageView alloc] initWithFrame:self.bounds] autorelease];
        imageView.image = [UIImage imageNamed:imageNamed];
        [self addSubview:imageView];
    }
    return self;
}

/**
 * タッチイベント開始
 */
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
}

/**
 * タッチイベント終了
 */
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
}</pre><p></p>
<p>touchesBeganとthouchesEndedを追加するだけ。</p>
<p>次はタッチイベント内でアニメーションを設定する。</p>
<p>画像がタッチされたらその画像が画面いっぱいに拡大されるアニメーションを設定する。画面中段に複数の画像が敷き詰められた状況を想定する。</p>
<p></p><pre class="crayon-plain-tag">/**
 * タッチイベント開始
 * アニメーションの設定
 * 1.画像を画面の真ん中に移動する
 * 2.画像を画面サイズに拡大する
 */
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    // Viewを最前面に持ってくる
    [self.superview bringSubviewToFront:self];
    // アニメーション設定開始
    [UIView beginAnimations:nil context:NULL];
    // 0.1秒かけて
    [UIView setAnimationDuration:0.1];
    // 位置を真ん中に移動する
    CGFloat x = (self.superview.frame.size.width / 2 - self.frame.size.width / 2) - self.frame.origin.x;
    CGAffineTransform trans = CGAffineTransformMakeTranslation(x, 0);
    // superviewと同じサイズに拡大する
    CGFloat width = self.superview.frame.size.width / self.frame.size.width;
    CGFloat height = self.superview.frame.size.height / self.frame.size.height;
    CGAffineTransform scale = CGAffineTransformMakeScale(width, height);
    // Affine変換
    self.transform = CGAffineTransformConcat(scale, trans);
    // アニメーションをコミット
    [UIView commitAnimations];
}

/**
 * タッチイベント終了
 * アニメーションでオリジナルの座標に戻して、何もなかったかのようにする。
 */
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    // オリジナルの座標に戻す
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.1];
    self.transform = CGAffineTransformIdentity;
    [UIView commitAnimations];
}</pre><p></p>
<p>あとは、UIViewControllerでこのUIViewをサブビューとして追加していけばいい。</p>
<p></p><pre class="crayon-plain-tag">- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];

    // 画像４枚分
    int count = 4;

    // 幅と高さを画像の分だけ小さく
    CGRect rect = self.view.bounds;
    rect.size.width /= count;
    rect.size.height /= count;

    // 高さは真ん中にくるように
    rect.origin.y = self.view.bounds.size.height / 2 - rect.size.height / 2;

    KurukuruView *kurukuruView;

    rect.origin.x = 0;
    kurukuruView = [[KurukuruView alloc] initWithFrame:rect withImageNamed:@&amp;quot;test1.jpg&amp;quot;];
    [self.view addSubview:kurukuruView];

    rect.origin.x += rect.size.width;
    kurukuruView = [[KurukuruView alloc] initWithFrame:rect withImageNamed:@&amp;quot;test2.jpg&amp;quot;];
    [self.view addSubview:kurukuruView];

    rect.origin.x += rect.size.width;
    kurukuruView = [[KurukuruView alloc] initWithFrame:rect withImageNamed:@&amp;quot;test3.jpg&amp;quot;];
    [self.view addSubview:kurukuruView];

    rect.origin.x += rect.size.width;
    kurukuruView = [[KurukuruView alloc] initWithFrame:rect withImageNamed:@&amp;quot;test4.jpg&amp;quot;];
    [self.view addSubview:kurukuruView];
}</pre><p></p>
<p>実装した結果がこんな感じ。</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/KyasS3DLwys" /><embed type="application/x-shockwave-flash" width="550" height="400" src="http://www.youtube.com/v/KyasS3DLwys"></embed></object></p>
<p>動作は軽快。ぬるぬる動いてる。</p>
<p>色んなことができそうな予感がする。</p>
<p><a href="http://seiichirou.jp/2011/03/01/uiview%e3%81%ae%e3%82%bf%e3%83%83%e3%83%81%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88%e3%81%a8coreanimation%e3%82%92%e8%a9%a6%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/">UIViewのタッチイベントとAnimationを試してみる</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/03/01/uiview%e3%81%ae%e3%82%bf%e3%83%83%e3%83%81%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88%e3%81%a8coreanimation%e3%82%92%e8%a9%a6%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interface Builderを使わないアプリ開発の為の準備</title>
		<link>http://seiichirou.jp/2011/02/24/interface-builder%e3%82%92%e4%bd%bf%e3%82%8f%e3%81%aa%e3%81%84%e3%82%a2%e3%83%97%e3%83%aa%e9%96%8b%e7%99%ba%e3%81%ae%e7%82%ba%e3%81%ae%e6%ba%96%e5%82%99/</link>
		<comments>http://seiichirou.jp/2011/02/24/interface-builder%e3%82%92%e4%bd%bf%e3%82%8f%e3%81%aa%e3%81%84%e3%82%a2%e3%83%97%e3%83%aa%e9%96%8b%e7%99%ba%e3%81%ae%e7%82%ba%e3%81%ae%e6%ba%96%e5%82%99/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 12:50:58 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Interface Builder]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=318</guid>
		<description><![CDATA[<p>Interface Builderはなかなか完成されたツールだけど、nibファイルの変更のために立ち上げたり、細かい設定が面倒だったりするので、基本Interface Builder抜きで開発を進めてる。 nibファイルとInterface Builderを使わないでWindowベースアプリをビルドして起動させるまで、必要な作業を残しておく。 Window based Applicationのプロジェクトを新規作成。 MainWindow.xibファイルを削除する Info.plistのMain nib file base nameを削除する main関数のUIApplicationMain関数の引数にAppDelegate Classを指定する AppDelegate ClassのdidFinishLaunchingWithOptionsを削除する AppDelegate ClassのapplicationDidFinishLaunchingを実装する ビルドして実行 以上。 Interface Builderを使わないアプリ開発の為の準備 is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/02/24/interface-builder%e3%82%92%e4%bd%bf%e3%82%8f%e3%81%aa%e3%81%84%e3%82%a2%e3%83%97%e3%83%aa%e9%96%8b%e7%99%ba%e3%81%ae%e7%82%ba%e3%81%ae%e6%ba%96%e5%82%99/">Interface Builderを使わないアプリ開発の為の準備</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Interface Builderはなかなか完成されたツールだけど、nibファイルの変更のために立ち上げたり、細かい設定が面倒だったりするので、基本Interface Builder抜きで開発を進めてる。</p>
<p>nibファイルとInterface Builderを使わないでWindowベースアプリをビルドして起動させるまで、必要な作業を残しておく。</p>
<p><span id="more-318"></span></p>
<ol>
<li>Window based Applicationのプロジェクトを新規作成。</li>
<p><a href="http://seiichirou.jp/wp-content/uploads/2011/02/ad2f630a60e15470c374b9bfd14fbeff.png"><img class="alignnone size-medium wp-image-324" title="スクリーンショット（2011-02-24 21.28.45）" src="http://seiichirou.jp/wp-content/uploads/2011/02/ad2f630a60e15470c374b9bfd14fbeff-390x300.png" alt="" width="390" height="300" /></a></p>
<li>MainWindow.xibファイルを削除する</li>
<p><a href="http://seiichirou.jp/wp-content/uploads/2011/02/dc6d65b4c18bc3492a3ec955a11eb447.png"><img class="alignnone size-medium wp-image-325" title="スクリーンショット（2011-02-24 21.30.53）" src="http://seiichirou.jp/wp-content/uploads/2011/02/dc6d65b4c18bc3492a3ec955a11eb447-432x300.png" alt="" width="432" height="300" /></a></p>
<li>Info.plistのMain nib file base nameを削除する</li>
<p><a href="http://seiichirou.jp/wp-content/uploads/2011/02/186f88a48089be48f46edee179473e01.png"><img class="alignnone size-medium wp-image-326" title="スクリーンショット（2011-02-24 21.31.53）" src="http://seiichirou.jp/wp-content/uploads/2011/02/186f88a48089be48f46edee179473e01-432x300.png" alt="" width="432" height="300" /></a></p>
<li>main関数のUIApplicationMain関数の引数にAppDelegate Classを指定する</li>
<p><a href="http://seiichirou.jp/wp-content/uploads/2011/02/9ce21518dcff6e5cfaaa89253f6339d5.png"><img class="alignnone size-medium wp-image-327" title="スクリーンショット（2011-02-24 21.45.55）" src="http://seiichirou.jp/wp-content/uploads/2011/02/9ce21518dcff6e5cfaaa89253f6339d5-462x300.png" alt="" width="462" height="300" /></a></p>
<li>AppDelegate ClassのdidFinishLaunchingWithOptionsを削除する</li>
<p><a href="http://seiichirou.jp/wp-content/uploads/2011/02/8057ec92105f41f04299df7956a0f305.png"><img class="alignnone size-medium wp-image-328" title="スクリーンショット（2011-02-24 21.46.50）" src="http://seiichirou.jp/wp-content/uploads/2011/02/8057ec92105f41f04299df7956a0f305-462x300.png" alt="" width="462" height="300" /></a></p>
<li>AppDelegate ClassのapplicationDidFinishLaunchingを実装する</li>
<p><a href="http://seiichirou.jp/wp-content/uploads/2011/02/760ce0be7106ce60f53f408b9ea7c313.png"><img class="alignnone size-medium wp-image-329" title="スクリーンショット（2011-02-24 21.47.44）" src="http://seiichirou.jp/wp-content/uploads/2011/02/760ce0be7106ce60f53f408b9ea7c313-462x300.png" alt="" width="462" height="300" /></a></p>
<li>ビルドして実行</li>
<p><a href="http://seiichirou.jp/wp-content/uploads/2011/02/1f8c21a9d781954c9cb5ee33feab4a92.png"><img class="alignnone size-medium wp-image-330" title="スクリーンショット（2011-02-24 21.42.26）" src="http://seiichirou.jp/wp-content/uploads/2011/02/1f8c21a9d781954c9cb5ee33feab4a92-217x300.png" alt="" width="217" height="300" /></a></ol>
<p>以上。</p>
<p><a href="http://seiichirou.jp/2011/02/24/interface-builder%e3%82%92%e4%bd%bf%e3%82%8f%e3%81%aa%e3%81%84%e3%82%a2%e3%83%97%e3%83%aa%e9%96%8b%e7%99%ba%e3%81%ae%e7%82%ba%e3%81%ae%e6%ba%96%e5%82%99/">Interface Builderを使わないアプリ開発の為の準備</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/02/24/interface-builder%e3%82%92%e4%bd%bf%e3%82%8f%e3%81%aa%e3%81%84%e3%82%a2%e3%83%97%e3%83%aa%e9%96%8b%e7%99%ba%e3%81%ae%e7%82%ba%e3%81%ae%e6%ba%96%e5%82%99/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AVCaptureStillImageOutputを実装して静止画を撮る</title>
		<link>http://seiichirou.jp/2011/02/22/avcapturestillimageoutput%e3%82%92%e5%ae%9f%e8%a3%85%e3%81%97%e3%81%a6%e9%9d%99%e6%ad%a2%e7%94%bb%e3%82%92%e6%92%ae%e3%82%8b/</link>
		<comments>http://seiichirou.jp/2011/02/22/avcapturestillimageoutput%e3%82%92%e5%ae%9f%e8%a3%85%e3%81%97%e3%81%a6%e9%9d%99%e6%ad%a2%e7%94%bb%e3%82%92%e6%92%ae%e3%82%8b/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 17:06:47 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[AVCaptureDevice]]></category>
		<category><![CDATA[AVCaptureDeviceInput]]></category>
		<category><![CDATA[AVCaptureSession]]></category>
		<category><![CDATA[AVCaptureStillImageOutput]]></category>
		<category><![CDATA[AVCaptureVideoPreviewLayer]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=313</guid>
		<description><![CDATA[<p>iPhoneで静止画キャプチャを撮るために、AVCpatureStillImageOutputを使ってみる。 AVCaptureSessionの出力にAVCaptureStillImageOutputを設定してやればいい。 今回は、画面に４×４個のボタンを配置して、各ボタンが押されたときにそのボタン自身にキャプチャした静止画を貼り付けるようにする。 動かしてみた感じは以下。 AVCaptureStillImageOutputを実装して静止画を撮る is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/02/22/avcapturestillimageoutput%e3%82%92%e5%ae%9f%e8%a3%85%e3%81%97%e3%81%a6%e9%9d%99%e6%ad%a2%e7%94%bb%e3%82%92%e6%92%ae%e3%82%8b/">AVCaptureStillImageOutputを実装して静止画を撮る</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<p>iPhoneで静止画キャプチャを撮るために、AVCpatureStillImageOutputを使ってみる。</p>
<p>AVCaptureSessionの出力にAVCaptureStillImageOutputを設定してやればいい。</p>
<p><span id="more-313"></span></p>
<p></p><pre class="crayon-plain-tag">- (void)viewDidLoad {
    [super viewDidLoad];

    // キャプチャセッションを作る
    _captureSession = [[AVCaptureSession alloc]init];

    // ビデオの解像度 Midium
    if ([_captureSession canSetSessionPreset:AVCaptureSessionPresetMedium]) {
        _captureSession.sessionPreset = AVCaptureSessionPresetMedium;
    }

    // ビデオデバイスを取って
    AVCaptureDevice *captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];

    // 入力を作る
    NSError *error = nil;
    AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:captureDevice error:&amp;amp;error];

    // セッションに入力を追加
    [_captureSession addInput:input];

    // AVCaptureStillImageOutputで静止画出力を作る
    _stillImageOutput = [[AVCaptureStillImageOutput alloc] init];
    NSDictionary *outputSettings = [[NSDictionary alloc] initWithObjectsAndKeys:
                                    AVVideoCodecJPEG, AVVideoCodecKey, nil];
    _stillImageOutput.outputSettings = outputSettings;
    [outputSettings release];

    // セッションに出力を追加
    [_captureSession addOutput:_stillImageOutput];

    // プレビューレイヤーを作って
    AVCaptureVideoPreviewLayer *videoPreviewLayer = [AVCaptureVideoPreviewLayer layerWithSession:_captureSession];
    // リサイズ形式を設定して
    videoPreviewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
    // フレームサイズを設定して
    videoPreviewLayer.frame = self.view.bounds;
    // ビューのサブレイヤーにビデオ出力レイヤーを追加
    [self.view.layer addSublayer:videoPreviewLayer];

    // 4&times;4個のボタンを作る
    for (int i = 0; i &amp;lt; 4; i++) {
        for (int j = 0; j &amp;lt; 4; j++) {
            int width = [UIScreen mainScreen].bounds.size.width / 4;
            int height = [UIScreen mainScreen].bounds.size.height / 4;
            int x = width * j;
            int y = height * i;

            // ボタンを作る
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            button.frame = CGRectMake(x, y, width, height);

            // キャプチャイベント
            [button addTarget:self action:@selector(capture:) forControlEvents:UIControlEventTouchDown];

            // ビューにサブビューとして追加
            [self.view addSubview:button];
        }
    }
    // セッションを開始
    [_captureSession startRunning];
}</pre><p></p>
<p>今回は、画面に４×４個のボタンを配置して、各ボタンが押されたときにそのボタン自身にキャプチャした静止画を貼り付けるようにする。</p>
<p></p><pre class="crayon-plain-tag">- (void)capture:(id)sender {
    // コネクションを検索
    AVCaptureConnection *videoConnection = nil;
    for (AVCaptureConnection *connection in _stillImageOutput.connections) {
        for (AVCaptureInputPort *port in [connection inputPorts]) {
            if ([[port mediaType] isEqual:AVMediaTypeVideo] ) {
                videoConnection = connection;
                break;
            }
        }
        if (videoConnection)
            break;
	}

    // 静止画をキャプチャする
    [_stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection
                                                   completionHandler:
     ^(CMSampleBufferRef imageSampleBuffer, NSError *error) {
         if (imageSampleBuffer != NULL) {
             // キャプチャしたデータを取る
             NSData *data = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];
             // 押されたボタンにキャプチャした静止画を設定する
             UIButton *button = (UIButton*)sender;
             [button setBackgroundImage:[UIImage imageWithData:data] forState:UIControlStateNormal];
             [button setBackgroundImage:[UIImage imageWithData:data] forState:UIControlStateHighlighted];
         }
     }];
}</pre><p></p>
<p>動かしてみた感じは以下。</p>
<p><object style="width: 550px; height: 400px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/zGMPlnldrcM" /><embed style="width: 550px; height: 400px;" type="application/x-shockwave-flash" width="550" height="400" src="http://www.youtube.com/v/zGMPlnldrcM"></embed></object></p>
<p><a href="http://seiichirou.jp/2011/02/22/avcapturestillimageoutput%e3%82%92%e5%ae%9f%e8%a3%85%e3%81%97%e3%81%a6%e9%9d%99%e6%ad%a2%e7%94%bb%e3%82%92%e6%92%ae%e3%82%8b/">AVCaptureStillImageOutputを実装して静止画を撮る</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/02/22/avcapturestillimageoutput%e3%82%92%e5%ae%9f%e8%a3%85%e3%81%97%e3%81%a6%e9%9d%99%e6%ad%a2%e7%94%bb%e3%82%92%e6%92%ae%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AVCaptureSessionとAVCaptureDeviceInputでカメラ入力表示</title>
		<link>http://seiichirou.jp/2011/02/19/avcapturesession%e3%81%a8avcapturedeviceinput%e3%81%a7%e3%82%ab%e3%83%a1%e3%83%a9%e5%85%a5%e5%8a%9b%e8%a1%a8%e7%a4%ba/</link>
		<comments>http://seiichirou.jp/2011/02/19/avcapturesession%e3%81%a8avcapturedeviceinput%e3%81%a7%e3%82%ab%e3%83%a1%e3%83%a9%e5%85%a5%e5%8a%9b%e8%a1%a8%e7%a4%ba/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 16:11:46 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[AVCaptureDevice]]></category>
		<category><![CDATA[AVCaptureDeviceInput]]></category>
		<category><![CDATA[AVCaptureSession]]></category>
		<category><![CDATA[AVCaptureVideoPreviewLayer]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=298</guid>
		<description><![CDATA[<p>カメラアプリ作成の為に、まず画面にカメラからの入力を表示させてみる。 AVCaptureSessionにAVCaptureDeviceInputをくっつけて、AVCaptureVideoPreviewLayerでViewに表示する。 こんな感じでカメラからの入力が表示される。動画アップのテストも兼ねて。 AVCaptureSessionとAVCaptureDeviceInputでカメラ入力表示 is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/02/19/avcapturesession%e3%81%a8avcapturedeviceinput%e3%81%a7%e3%82%ab%e3%83%a1%e3%83%a9%e5%85%a5%e5%8a%9b%e8%a1%a8%e7%a4%ba/">AVCaptureSessionとAVCaptureDeviceInputでカメラ入力表示</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<p>カメラアプリ作成の為に、まず画面にカメラからの入力を表示させてみる。</p>
<p>AVCaptureSessionにAVCaptureDeviceInputをくっつけて、AVCaptureVideoPreviewLayerでViewに表示する。</p>
<p><span id="more-298"></span></p>
<p></p><pre class="crayon-plain-tag">- (void)viewDidLoad {
    [super viewDidLoad];

    // キャプチャセッションを作る
    _captureSession = [[AVCaptureSession alloc]init];

    // ビデオの解像度　ミドル
    if ([_captureSession canSetSessionPreset:AVCaptureSessionPresetMedium]) {
        _captureSession.sessionPreset = AVCaptureSessionPresetMedium;
    }

    // ビデオ入力の設定
    NSError *error = nil;
    // ビデオデバイスを取って
    AVCaptureDevice *captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
    // デバイス入力を
    AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:captureDevice error:&amp;amp;error];
    if (!input) {
        NSLog(@&amp;quot;input error&amp;quot;);
    }
    // キャプチャセッションに追加する
    [_captureSession addInput:input];

    // プレビューレイヤーを作って
    AVCaptureVideoPreviewLayer *videoPreviewLayer = [AVCaptureVideoPreviewLayer layerWithSession:_captureSession];
    // リサイズ形式を設定して
    videoPreviewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
    // フレームサイズを設定して
    videoPreviewLayer.frame = self.view.bounds;
    // サブレイヤーとして追加する
    [self.view.layer addSublayer:videoPreviewLayer];

    // キャプチャセッションを開始
    [_captureSession startRunning];
}</pre><p></p>
<p>こんな感じでカメラからの入力が表示される。動画アップのテストも兼ねて。<br />
<object style="width: 580px; height: 350px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="580" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/FDK8GD8PWY4" /><embed style="width: 580px; height: 350px;" type="application/x-shockwave-flash" width="580" height="350" src="http://www.youtube.com/v/FDK8GD8PWY4"></embed></object></p>
<p><a href="http://seiichirou.jp/2011/02/19/avcapturesession%e3%81%a8avcapturedeviceinput%e3%81%a7%e3%82%ab%e3%83%a1%e3%83%a9%e5%85%a5%e5%8a%9b%e8%a1%a8%e7%a4%ba/">AVCaptureSessionとAVCaptureDeviceInputでカメラ入力表示</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/02/19/avcapturesession%e3%81%a8avcapturedeviceinput%e3%81%a7%e3%82%ab%e3%83%a1%e3%83%a9%e5%85%a5%e5%8a%9b%e8%a1%a8%e7%a4%ba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UITabBarControllerとUINavigationControllerを併用する</title>
		<link>http://seiichirou.jp/2011/02/18/uitabbarcontroller%e3%81%a8uinavigationcontroller%e3%82%92%e4%bd%b5%e7%94%a8%e3%81%99%e3%82%8b/</link>
		<comments>http://seiichirou.jp/2011/02/18/uitabbarcontroller%e3%81%a8uinavigationcontroller%e3%82%92%e4%bd%b5%e7%94%a8%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 15:41:17 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[UINavigationController]]></category>
		<category><![CDATA[UITabBarController]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=285</guid>
		<description><![CDATA[<p>UITabBarControllerとUINavigationControllerを併用する。 ４つのUINavigationControllerに４つのUITableViewController。 それをUITabBarControllerにすべて設定する。 こんな感じになる。 動いているので多分大丈夫。 UITabBarControllerとUINavigationControllerを併用する is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/02/18/uitabbarcontroller%e3%81%a8uinavigationcontroller%e3%82%92%e4%bd%b5%e7%94%a8%e3%81%99%e3%82%8b/">UITabBarControllerとUINavigationControllerを併用する</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<p>UITabBarControllerとUINavigationControllerを併用する。</p>
<p>４つのUINavigationControllerに４つのUITableViewController。</p>
<p>それをUITabBarControllerにすべて設定する。</p>
<p><span id="more-285"></span></p>
<p></p><pre class="crayon-plain-tag">- (void)applicationDidFinishLaunching:(UIApplication *)application {
    LOG(@&amp;quot;&amp;quot;);

    // UIWindowの初期化
    window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];

    // テーブルビュー
    UITableViewController *viewController1 = [[[UITableViewController alloc]init]autorelease];
    viewController1.title = @&amp;quot;table1&amp;quot;;
    viewController1.navigationItem.title = @&amp;quot;table1&amp;quot;;

    // テーブルビュー
    UITableViewController *viewController2 = [[[UITableViewController alloc]init]autorelease];
    viewController2.title = @&amp;quot;table2&amp;quot;;
    viewController2.navigationItem.title = @&amp;quot;table2&amp;quot;;

    // テーブルビュー
    UITableViewController *viewController3 = [[[UITableViewController alloc]init]autorelease];
    viewController3.title = @&amp;quot;table3&amp;quot;;
    viewController3.navigationItem.title = @&amp;quot;table3&amp;quot;;

    // テーブルビュー
    UITableViewController *viewController4 = [[[UITableViewController alloc]init]autorelease];
    viewController4.title = @&amp;quot;table4&amp;quot;;
    viewController4.navigationItem.title = @&amp;quot;table4&amp;quot;;

    NSArray *array = [NSArray arrayWithObjects:
                       [[[UINavigationController alloc]initWithRootViewController:viewController1]autorelease],
                       [[[UINavigationController alloc]initWithRootViewController:viewController2]autorelease],
                       [[[UINavigationController alloc]initWithRootViewController:viewController3]autorelease],
                       [[[UINavigationController alloc]initWithRootViewController:viewController4]autorelease],
                       nil];

    // Tab Bar Controllerの初期化
    UITabBarController *tabBarController = [[[UITabBarController alloc]init]autorelease];
    [tabBarController setViewControllers:array];

    // Windowへルートを設定する
    window.rootViewController = tabBarController;

    // Windowの作成と表示
    [window makeKeyAndVisible];
}</pre><p></p>
<p>こんな感じになる。</p>
<p><a href="http://seiichirou.jp/wp-content/uploads/2011/02/IMG_0148.png"><img class="alignnone size-medium wp-image-287" title="IMG_0148" src="http://seiichirou.jp/wp-content/uploads/2011/02/IMG_0148-200x300.png" alt="" width="200" height="300" /></a></p>
<p>動いているので多分大丈夫。</p>
<p><a href="http://seiichirou.jp/2011/02/18/uitabbarcontroller%e3%81%a8uinavigationcontroller%e3%82%92%e4%bd%b5%e7%94%a8%e3%81%99%e3%82%8b/">UITabBarControllerとUINavigationControllerを併用する</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/02/18/uitabbarcontroller%e3%81%a8uinavigationcontroller%e3%82%92%e4%bd%b5%e7%94%a8%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UIToolbarの実装の仕方</title>
		<link>http://seiichirou.jp/2011/02/16/uitoolbar%e3%81%ae%e5%ae%9f%e8%a3%85%e3%81%ae%e4%bb%95%e6%96%b9/</link>
		<comments>http://seiichirou.jp/2011/02/16/uitoolbar%e3%81%ae%e5%ae%9f%e8%a3%85%e3%81%ae%e4%bb%95%e6%96%b9/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 16:19:40 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[UIToolbar]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=275</guid>
		<description><![CDATA[<p>UIToolbarとUIBarButtonItemの実装をInterfaceBuilderを使わないでやってみる。 このコードで下のような表示になる。 アイテム間に何も挟んでないので左詰めになってる。 UIToolbarのアイテムはいつでもsetItemで他のアイテムに変えることができる。 UIToolbarの実装の仕方 is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/02/16/uitoolbar%e3%81%ae%e5%ae%9f%e8%a3%85%e3%81%ae%e4%bb%95%e6%96%b9/">UIToolbarの実装の仕方</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<p>UIToolbarとUIBarButtonItemの実装をInterfaceBuilderを使わないでやってみる。</p>
<p></p><pre class="crayon-plain-tag">- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor whiteColor];

    // ツールバー
    UIToolbar *toolBar = [[[UIToolbar alloc]init]autorelease];
    toolBar.barStyle = UIBarStyleBlackTranslucent;
    [toolBar setFrame:CGRectMake(0, 416, self.view.bounds.size.width, 44)];
    [self.view addSubview:toolBar];

    // カメラボタン
    UIBarButtonItem *cameraButton =
    [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCamera
                                                  target:self
                                                  action:@selector(camera:)]autorelease];
    cameraButton.style = UIBarButtonItemStyleBordered;

    // 設定ボタン
    UIBarButtonItem *settingButton =
    [[[UIBarButtonItem alloc]initWithTitle:@&amp;quot;Setting&amp;quot;
                                     style:UIBarButtonItemStyleBordered
                                    target:self
                                    action:@selector(setting:)]autorelease];

    // キャンセルボタン
    UIBarButtonItem *cancelButton =
    [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
                                                  target:self
                                                  action:@selector(cancel:)]autorelease];

    [toolBar setItems:[NSArray arrayWithObjects:cameraButton, settingButton, cancelButton, nil]];
}</pre><p><span id="more-275"></span></pre>
<p>このコードで下のような表示になる。</p>
<p><a href="http://seiichirou.jp/wp-content/uploads/2011/02/IMG_0147.png"><img class="alignnone size-medium wp-image-283" title="IMG_0147" src="http://seiichirou.jp/wp-content/uploads/2011/02/IMG_0147-200x300.png" alt="" width="200" height="300" /></a></p>
<p>アイテム間に何も挟んでないので左詰めになってる。</p>
<p>UIToolbarのアイテムはいつでもsetItemで他のアイテムに変えることができる。</p>
<p><a href="http://seiichirou.jp/2011/02/16/uitoolbar%e3%81%ae%e5%ae%9f%e8%a3%85%e3%81%ae%e4%bb%95%e6%96%b9/">UIToolbarの実装の仕方</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/02/16/uitoolbar%e3%81%ae%e5%ae%9f%e8%a3%85%e3%81%ae%e4%bb%95%e6%96%b9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NSLogにクラス名とメソッド名を付加するマクロ</title>
		<link>http://seiichirou.jp/2011/02/11/nslog%e3%81%ab%e3%82%af%e3%83%a9%e3%82%b9%e5%90%8d%e3%81%a8%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e5%90%8d%e3%82%92%e4%bb%98%e5%8a%a0%e3%81%99%e3%82%8b%e3%83%9e%e3%82%af%e3%83%ad/</link>
		<comments>http://seiichirou.jp/2011/02/11/nslog%e3%81%ab%e3%82%af%e3%83%a9%e3%82%b9%e5%90%8d%e3%81%a8%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e5%90%8d%e3%82%92%e4%bb%98%e5%8a%a0%e3%81%99%e3%82%8b%e3%83%9e%e3%82%af%e3%83%ad/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 15:38:55 +0000</pubDate>
		<dc:creator>seiichi3141</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[NSLog]]></category>

		<guid isPermaLink="false">http://seiichirou.jp/?p=201</guid>
		<description><![CDATA[<p>NSLogで出力するログにはクラス名とメソッド名を表示させておくとデバッグがやりやすいはず。 なので、直接NSLogを使わないでマクロで簡単にクラス名とメソッド名を表示させるようにしておく。 objective-cでは__func__マクロでクラス名とメソッド名の文字列に置き換えてくれるので、それと表示したいログを繋げてからNSLogで表示するマクロを作る。 これを使って、こんなコードを通れば、 こんな表示が出る。 [iPhone][Objective-C] NSLogの出力ログにクラス名とメソッド名を追加するマクロ NSLogにクラス名とメソッド名を付加するマクロ is a post from: 虎視眈々</p>
 <p><a href="http://seiichirou.jp/2011/02/11/nslog%e3%81%ab%e3%82%af%e3%83%a9%e3%82%b9%e5%90%8d%e3%81%a8%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e5%90%8d%e3%82%92%e4%bb%98%e5%8a%a0%e3%81%99%e3%82%8b%e3%83%9e%e3%82%af%e3%83%ad/">NSLogにクラス名とメソッド名を付加するマクロ</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></description>
			<content:encoded><![CDATA[<p>NSLogで出力するログにはクラス名とメソッド名を表示させておくとデバッグがやりやすいはず。<br />
なので、直接NSLogを使わないでマクロで簡単にクラス名とメソッド名を表示させるようにしておく。<br />
objective-cでは__func__マクロでクラス名とメソッド名の文字列に置き換えてくれるので、それと表示したいログを繋げてからNSLogで表示するマクロを作る。</p><pre class="crayon-plain-tag">#define LOG(args...) NSLog([[NSString stringWithFormat:@&quot;%s &quot;, __func__] stringByAppendingFormat:args],nil)</pre><p>これを使って、こんなコードを通れば、</p><pre class="crayon-plain-tag">- (void)viewDidLoad {
    LOG(@&quot;&quot;);
}</pre><p>こんな表示が出る。</p><pre class="crayon-plain-tag">2011-02-11 00:32:10.306 Gifji3D[19406:307] -[LibraryViewController viewDidLoad]</pre><p><a href="http://d.hatena.ne.jp/mmasashi/20101009/1286814294" target="_blank"> [iPhone][Objective-C] NSLogの出力ログにクラス名とメソッド名を追加するマクロ</a></p>
<p><a href="http://seiichirou.jp/2011/02/11/nslog%e3%81%ab%e3%82%af%e3%83%a9%e3%82%b9%e5%90%8d%e3%81%a8%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e5%90%8d%e3%82%92%e4%bb%98%e5%8a%a0%e3%81%99%e3%82%8b%e3%83%9e%e3%82%af%e3%83%ad/">NSLogにクラス名とメソッド名を付加するマクロ</a> is a post from: <a href="http://seiichirou.jp">虎視眈々</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seiichirou.jp/2011/02/11/nslog%e3%81%ab%e3%82%af%e3%83%a9%e3%82%b9%e5%90%8d%e3%81%a8%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e5%90%8d%e3%82%92%e4%bb%98%e5%8a%a0%e3%81%99%e3%82%8b%e3%83%9e%e3%82%af%e3%83%ad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

