Onsg11 iphone

1,392 views

Published on

Published in: Technology, News & Politics
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,392
On SlideShare
0
From Embeds
0
Number of Embeds
115
Actions
Shares
0
Downloads
9
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Onsg11 iphone

  1. 1. iPhone Sora Harakami 5/30/2010 - Online.sg #11 * OpenForce
  2. 2. • @sora_h • http://sorah.cosmio.net/ • Sora Harakami • Online.sg • Obj-C • Cocoa (touch) • • iPad • Rubyist
  3. 3. • Online.sg • onsg •
  4. 4. Agenda • iPhone SDK / Obj-C • iPhone Hello, World simulator • App Store
  5. 5. iPhone
  6. 6. • iPhone SDK • XCode • Mac • • Objective
  7. 7. What's "Objective- C" ? • Cocoa iPhone / iPad • objective •C • Google
  8. 8. • Ruby ! • if neocon!
  9. 9. Ruby # Comment "hoge" # String Obj-C // Comment @"hoge"; # NSString
  10. 10. Ruby foo.bar() foo.calc(1,"add") foo.result #=> 1 Obj-C [foo bar]; [foo calc:1 withMethod:@"add"]; foo.result
  11. 11. Ruby Hoge.new Hoge.new(123) Obj-C [Hoge alloc]; [[Hoge alloc] init:123];
  12. 12. Ruby hoge = "abc" Obj-C NSString *hoge = @"hoge";
  13. 13. // Header @interface Hoge : NSObject { // Instance variables NSString *foo; } // methods -(void) huga:(NSString *)str; @end
  14. 14. // Implementation #import "hoge.h" // Header file @implementation Hoge -(void)huga: (NSString *)str { // Do something.... } @end
  15. 15. -(void)foo:(NSString *) bar:(NSString *) {...} -(void)foo:(NSString *) bar:(NSString *)
  16. 16. • Append Hello, world
  17. 17. • iPhone: Apple • XCode: Mac/iPhone IDE • Interface builder: UI
  18. 18. Hello, world 1. 2. Interface Builder UI 3. XCode 4. IB 5.
  19. 19. 1. XCode 2. Cmd-Shift-N 3. "iPhone OS" > "Application" 4. "View-Based Application" 5. Product iPhone enter 6. xcodeproj "onsg11"
  20. 20. Interface Builder? • • GUI • UI
  21. 21. IB • "onsg11ViewController.xib" • Tools • View "Round Rect Button" • Label
  22. 22. • Apple • • Append • Hello •
  23. 23. • *.h • *.m
  24. 24. Outlet and Action • : UI • : • ib
  25. 25. outlet/action Outlet • Action •
  26. 26. • XCode • Outlet • Action
  27. 27. onsg11ViewController.h @interface onsg11ViewController : UIViewController { IBOutlet UILabel *label; } ...
  28. 28. onsg11ViewController.h @interface onsg11ViewController { ... } -(IBAction) append: (id)sender; ... onsg11ViewController.m @implementation onsg11ViewController -(IBAction) append:(id) sender { // This method is called when button is pressed }
  29. 29. • IB • onsg11ViewController.xib view • → • "Touch Up Inside" ○ onsg11.. File's Owner • "append:"
  30. 30. • "File's owner" • label ○ hello •
  31. 31. • Label UILabel • text • •
  32. 32. onsg11ViewController.m @implementation onsg11ViewController -(IBAction) append:(id) sender { label.text = @"Hello, world"; }
  33. 33. • Xcode overview Simulator • Simulator - 3.x.x | Debug Build and run
  34. 34.
  35. 35. App Store • • iPhone dev program •
  36. 36. • • iPhone • iPad • • http://d.hatena.ne.jp/codnote/ 20100519/1274246643

×