PDA&Mobile2010/04/08 12:57
* 본 포스트는 Blog.MissFlash.com에서 작성한 것으로, 원문 저작자의 동의없이 마음대로 퍼가실 수 없습니다. 포스트의 내용이 마음에 드시면 링크를 이용해주시면 감사하겠습니다.

> Head First iPhone Development #4

Chapter 4. multiple views - A table with a view

The title of the main view
Setting the title for the main view of the app means that additional views will automatically have back buttons to get to the main view.

Display drink list
  1. Declare the drink array. (.h file)
    • NSMutableArray* drinks;
    • @property ~
    • @synthesize ~
  2. Implement and populate the array. (viewDidLoad method at .m file)
    • NSMutableArray* tmpArray = [[NSMutableArray alloc] initWithObjects:@"Firecracker", @"Lemon Drop", @"Mojito", nil];
  3. Tell the table how many rows you have. (numberOfRowsInSection method at .m file)
    • return [self.drinks count];
  4. Populate the table cells. (cellForRowAtIndexPath method at .m file)
    • cell.textLabel.text = [self.drinks objectAtIndex:indexPath.row];

Variable allocation

// 1st Method : Book

NSMutableArray* tmpArray = [[NSMutableArray allocinitWithObjects:@"Firecracker"@"Lemon Drop"@"Mojito"nil];

self.drinks = tmpArray;

[tmpArray release];


// 2nd Method : MissFlash

self.drinks = [[NSMutableArray allocinitWithObjects:@"Firecracker"@"Lemon Drop"@"Mojito"nil];


// 3rd Method : Book

NSString* path = [[NSBundle mainBundlepathForResource:@"DrinkArray" ofType:@"plist"];

NSMutableArray *tmpArray = [[NSMutableArray allocinitWithContentsOfFile:path];

self.drinks = tmpArray;

[tmpArray release];


Use the navigation controller to switch between views
  • A view stack for moving between views
  • A navigation bar for buttons and a title
  • A navigation toolbar for view-specific buttons

Navigation controllers maintain a stack of views
  • Use the tap notification in the table view delegate
  • tableview:didSelectRowAtIndexPath

Instantiate a view controller like any other class
  • [[DrinkDetailViewController alloc] initWithNibName:@"DrinkDetailViewController" bundle:nil];
  • At RootViewController.m

#import "DrinkDetailViewController.h"

...

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    DrinkDetailViewController *drinkDetailViewController = [[DrinkDetailViewController allocinitWithNibName:@"DrinkDetailViewController" bundle:nil];

    [self.navigationController pushViewController:drinkDetailViewController animated:YES];

    [drinkDetailViewController release];

}


Create a back button
When you added a title for the main view, the navigation controller kept track of that name as part of the view stack for navigation, and added a back button with the title in it automatically.

Debug process
  1. First stop on your debugging adventure: the console (Run -> Console)
  2. Interact with your application while it's running
  3. And when it's about to stop running
  4. Xcode supports you after your app breaks, too
  5. The Xcode debugger shows you the state of your application (Shift-Commander-Y key)



아이패드 국내 출시를 기원합니다. :-)
Steve Jobs for Fortune magazine
Steve Jobs for Fortune magazine by tsevis 저작자 표시비영리변경 금지
저작자 표시 비영리 변경 금지

이 글은 새로운 정보가 추가될 때마다 업데이트됩니다. 추천으로 아래 숫자에 1을 더해보세요. :)
RSS구독을 하시면 포스트를 배달해 드립니다. ▷ 한RSS 구독하기, 구글리더 구독하기

TRACKBACK http://blog.missflash.com/trackback/643 관련글 쓰기

  1. browse around here  삭제

    2014/09/09 09:40TRACKBACK FROM browse around here

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  2. a cool way to improve  삭제

    2014/09/09 17:04TRACKBACK FROM a cool way to improve

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  3. http://mad-man-muzik.com/  삭제

    2014/09/09 18:37TRACKBACK FROM http://mad-man-muzik.com/

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  4. http://Www.Thehtmlguide.com/activity/p/127076/  삭제

    2014/09/09 20:59TRACKBACK FROM http://Www.Thehtmlguide.com/activity/p/127076/

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  5. mad-man-muzik.com  삭제

    2014/09/09 22:14TRACKBACK FROM mad-man-muzik.com

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  6. develop on ios  삭제

    2014/09/10 00:08TRACKBACK FROM develop on ios

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  7. click here.  삭제

    2014/09/10 01:58TRACKBACK FROM click here.

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  8. Cluj.net  삭제

    2014/09/10 02:30TRACKBACK FROM Cluj.net

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  9. generalwellbeing.com  삭제

    2014/09/10 03:45TRACKBACK FROM generalwellbeing.com

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  10. high tech clock  삭제

    2014/09/10 06:34TRACKBACK FROM high tech clock

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  11. please click the up coming website page  삭제

    2014/09/10 10:04TRACKBACK FROM please click the up coming website page

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  12. gosiweek.co.kr  삭제

    2014/09/10 10:43TRACKBACK FROM gosiweek.co.kr

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  13. simply click the next website  삭제

    2014/09/10 17:52TRACKBACK FROM simply click the next website

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  14. waterlookitchenermoney.ca  삭제

    2014/09/11 20:50TRACKBACK FROM waterlookitchenermoney.ca

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  15. emergency cash  삭제

    2014/09/12 13:00TRACKBACK FROM emergency cash

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  16. http://lowlymiscellany27.soup.io/post/460613937/Starting-A-Gym-Business  삭제

    2014/09/12 18:26TRACKBACK FROM http://lowlymiscellany27.soup.io/post/460613937/Starting-A-Gym-Business

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  17. visit the next internet site  삭제

    2014/09/12 20:31TRACKBACK FROM visit the next internet site

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  18. hours past week  삭제

    2014/09/13 02:10TRACKBACK FROM hours past week

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  19. http://Lyricalschedule14.Jimdo.com/  삭제

    2014/09/17 16:15TRACKBACK FROM http://Lyricalschedule14.Jimdo.com/

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

  20. http://www.ezramedicalcare.com  삭제

    2014/09/19 12:51TRACKBACK FROM http://www.ezramedicalcare.com

    [ MissFlash - Digital Life ] :: 아이폰 앱 개발 팁(13) : Head First iPhone Development #4

댓글을 달아 주세요