Kentaro Kuribayashi's blog

Software Engineering, Management, Books, and Daily Journal.

iOS SDK Development勉強会 #1

会社で、iOS SDK Developmentの勉強会を開始した。最近、弊社はRubyづいていて@hsbt氏を中心にそのあたりの取り組みをしているので、iOSの本を読むこと自体は特に意味はないのだけど、単に僕がやりたくなったので巻き込んだ形。

iOS SDK Development

iOS SDK Development

他にもいい本はある(ヒレガス先生のiOS Programming: The Big Nerd Ranch Guide (3rd Edition) (Big Nerd Ranch Guides)とか)とは思うけど、この本は現状PragProgのベータ版ではあるものの、以下引用にあるように、iOS6が出たあかつきには内容を追従して更新すると宣言されているので、安心だと思われる。

With Apple’s announcement of iOS 6, we’re going to take a little time to update this book’s material so it’s up-to-date. Unfortunately, we’ll have to wait until Apple makes iOS 6 available to the public to make those changes available to you, but in the meantime we’re releasing an update to the book that fixes all the outstanding errata. When iOS 6 is released, you’ll automatically get all of the updates to this book.

The Pragmatic Bookshelf | iOS SDK Development

第1章

Xcodeの使い方を説明しつつ、ボタンを押したらツイートするアプリを作ろうという話。10行ほど書いただけでツイートできて、iOS5すげーなって感じ。その場でみんなで書いて、なんかしら動くように。

  • Round Rect Buttonをはっつける
  • ボタンを押した時のアクションをcontrollerに書く
  • そのアクションとボタンを、Interface Builderでひもづける
  • iOSデフォルトのTwitterに投稿する画面を使う時は、TWTweetComposeViewControllerを使う。
  • Twitterのクラスを使うためのLibraryを追加する。
  • アクションの中身を以下のような感じに書く
  • おわり
#import <Twitter/Twitter.h>

// (略)

- (IBAction)handleTweetButtonTapped:(id)sender
{
    if ([TWTweetComposeViewController canSendTweet]) {
        TWTweetComposeViewController *tweetVC =
        [[TWTweetComposeViewController alloc] init];
        [tweetVC setInitialText:
         @"I just finished the first project in iOS SDK Development. #pragsios"];
        [self presentViewController:tweetVC animated:YES completion:NULL]; }
    else
    {
        NSLog (@"Can't send tweet");
    }
}

がんばって続けましょう。