SlideShare ist ein Scribd-Unternehmen logo
1 von 70
 
순서 ,[object Object],[object Object],[object Object],[object Object]
1. 피커 (Picker), 탭바 (Tab bars) 란 ?  
(1)  피커 회전하는 다이얼이 들어있는 컨트롤 . (2)  탭바 하단에 버튼 영역 고정시켜 놓고 버튼을 선택함으로써 컨텐츠 영역을 바꾸는 컨트롤
2.  앞으로 만들어 볼 것들   
 
DatePicker
SinglePicker
DoubePicker
3.  메인 탭바의 구성을 만들자 .  
DependentPicker
CustomPicker
  -  개발 시나리오 (1)  다섯개의 탭이 들어가도록 기본 탭바를 만든다 . (2)  탭바에 아이콘 추가 (3)  데이트피커 ,  단일 컴포넌트 피커 ,  멀티 컴포넌트 피커 ,        의존컴포넌트를 활용한 피커 ,         이미지를 활용한 커스컴피커를 각 탭마다 추가한다 .
1.  프로젝트 명  Picker 로 생성 2. Group & files panel  최상단 폴더 선택후   command + n  클릭 3.
파일생성 및 각파일 생성 및 추가  그대로  next 하고 다음창도  next  저장할 이름은  "DatePickerViewController" 로 저장 . 그러면 확장자가  h,m,xib  파일 자동생성 이런식으로 SingleComponentPickerViewController DoubleComponentPickerViewController DependentComponentPickerViewController CustomPickerViewController  추가생성 supporting files 폴더 선택후  command+option+a 후 image,icon,music 파일 ,  사전파일  import
PickersAppDelegate.h #import <UIKit/UIKit.h> @interface PickersAppDelegate : NSObject <UIApplicationDelegate>  {       UIWindow *window;       UITabBarController *rootController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UITabBarController *rootController; @end
PickersAppDelegate.m #import &quot;PickersAppDelegate.h&quot; @implementation PickersAppDelegate  @synthesize window;  @synthesize rootController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { } // Override point for customization after app launch [self.window addSubview:rootController.view]; [self.window makeKeyAndVisible]; return YES; - (void)dealloc { } @end [rootController release]; [window release]; [super dealloc];
MainWindow.xib  수정
 
 
나머지도 이미지를 추가해서 아이콘 변경
4.  탭별 콤포넌트를 만들자 .  
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DatePickerView 를 만들어 봅시다 .  
-  DatePickerViewController.h #import <UIKit/UIKit.h>  @interface DatePickerViewController : UIViewController {      UIDatePicker *datePicker; } @property (nonatomic, retain) IBOutlet UIDatePicker *datePicker;   - (IBAction)buttonPressed;  @end
DataPickerViewController.xib 를 선택해서  interfaceBuilder 를 연다 .
 
ctrl +  files'owner  선택 드래그 해서  datePicker  컴포넌트에 드랍
버튼 더블클릭 해서 이름  press 로 명명 버튼을 누르면 IBAction 함수가 호출되도록
-  DatePickerViewController.m #import &quot;DatePickerViewController.h&quot; @implementation DatePickerViewController @synthesize datePicker; - (IBAction)buttonPressed  {        NSDate *selected = [datePicker date];       NSString *message = [[NSString alloc] initWithFormat:         @&quot;The date and time you selected is: %@&quot;, selected];       UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@&quot;Date and Time Selected&quot;                                                      message:message                                     delegate:nil cancelButtonTitle:@&quot;Yes, I did.&quot;                                     otherButtonTitles:nil];         [alert show];          [alert release];          [message release]; }
  - (void)viewDidLoad  {      NSDate *now = [[NSDate alloc] init];      [datePicker setDate:now animated:NO];       [now release]; } - (void)viewDidUnload {       [super viewDidUnload];        self.datePicker = nil; } - (void)dealloc {      [datePicker release];      [super dealloc]; }
버튼 클릭
SinglePickerView 를 만들어 봅시다 .  
- SingleComponentPickerViewController.h #import <UIKit/UIKit.h> @interface SingleComponentPickerViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource>   {       UIPickerView *singlePicker;      NSArray *pickerData;   } @property (nonatomic, retain) IBOutlet UIPickerView *singlePicker;  @property (nonatomic, retain) NSArray *pickerData;  - (IBAction)buttonPressed;  @end
SinglePickerViewController.xib 를 선택해서  interfaceBuilder 를 연다 .
 
ctrl +  files'owner  선택 드래그 해서  singlePicker  컴포넌트에 드랍
버튼 더블클릭 해서 이름  press 로 명명 버튼을 누르면 IBAction 함수가 호출되도록
- SingleComponentPickerViewController.m #import &quot;SingleComponentPickerViewController.h&quot; @implementation SingleComponentPickerViewController @synthesize singlePicker;  @synthesize pickerData; - (IBAction)buttonPressed  {      NSInteger row = [singlePicker selectedRowInComponent:0];       NSString *selected = [pickerData objectAtIndex:row];       NSString *title = [[NSString alloc] initWithFormat:@&quot;You selected %@!&quot;, selected];                                      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title                                        message:@&quot;Thank you for choosing.&quot;                                         delegate:nil                                        cancelButtonTitle:@&quot;You're Welcome&quot;                                                         otherButtonTitles:nil];      [alert show];       [alert release];       [title release]; }
- (void)viewDidLoad {      NSArray *array = [[NSArray alloc] initWithObjects:@&quot;Luke&quot;, @&quot;Leia&quot;,    @&quot;Han&quot;, @&quot;Chewbacca&quot;, @&quot;Artoo&quot;, @&quot;Threepio&quot;, @&quot;Lando&quot;, nil];      self.pickerData = array;      [array release]; } - (void)viewDidUnload {      [super viewDidUnload];      // Release any retained subviews of the main view.      // e.g. self.myOutlet = nil;       self.singlePicker = nil;      self.pickerData = nil; } - (void)dealloc {      [singlePicker release];      [pickerData release];      [super dealloc]; }
#pragma mark - #pragma mark Picker Data Source Methods - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {      return 1; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {      return [pickerData count]; } #pragma mark Picker Delegate Methods - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {      return [pickerData objectAtIndex:row]; }
버튼클릭
DoublePickerView 를 만들어 봅시다 .  
- DoubleComponentPickerViewController.h #import <UIKit/UIKit.h> #define kFillingComponent 0 #define kBreadComponent   1 @interface DoubleComponentPickerViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource> {      UIPickerView *doublePicker;      NSArray *fillingTypes;      NSArray *breadTypes; } @property(nonatomic, retain) IBOutlet UIPickerView *doublePicker;  @property(nonatomic, retain) NSArray *fillingTypes; @property(nonatomic, retain) NSArray *breadTypes; -(IBAction)buttonPressed; @end
- DoubleComponentPickerViewController.m #import &quot;DoubleComponentPickerViewController.h&quot; @implementation DoubleComponentPickerViewController @synthesize doublePicker; @synthesize fillingTypes; @synthesize breadTypes; -(IBAction)buttonPressed {      NSInteger fillingRow = [doublePicker selectedRowInComponent: kFillingComponent];      NSInteger breadRow = [doublePicker selectedRowInComponent:                            kBreadComponent];      NSString *bread = [breadTypes objectAtIndex:breadRow];      NSString *filling = [fillingTypes objectAtIndex:fillingRow];      NSString *message = [[NSString alloc] initWithFormat: @&quot;Your %@ on %@ bread will be right up.&quot;, filling, bread];      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:    @&quot;Thank you for your order&quot;                                                      message:message                                                     delegate:nil                                            cancelButtonTitle:@&quot;Great!&quot;                                            otherButtonTitles:nil];      [alert show];      [alert release];      [message release]; }
- (void)viewDidLoad {      NSArray *fillingArray = [[NSArray alloc] initWithObjects:@&quot;Ham&quot;, @&quot;Turkey&quot;, @&quot;Peanut Butter&quot;, @&quot;Tuna Salad&quot;, @&quot;Nutella&quot;, @&quot;Roast Beef&quot;, @&quot;Vegemite&quot;, nil];      self.fillingTypes = fillingArray;      [fillingArray release];      NSArray *breadArray = [[NSArray alloc] initWithObjects:@&quot;White&quot;,    @&quot;Whole Wheat&quot;, @&quot;Rye&quot;, @&quot;Sourdough&quot;, @&quot;Seven Grain&quot;,nil];      self.breadTypes = breadArray;      [breadArray release]; } - (void)viewDidUnload {      [super viewDidUnload];      // Release any retained subviews of the main view.      // e.g. self.myOutlet = nil;      self.doublePicker = nil;      self.breadTypes = nil;      self.fillingTypes = nil;   } - (void)dealloc {       [doublePicker release];      [breadTypes release];      [fillingTypes release];      [super dealloc]; }
#pragma mark - #pragma mark Picker Data Source Methods - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {      return 2; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {      if (component == kBreadComponent)          return [self.breadTypes count];      return [self.fillingTypes count]; } #pragma mark Picker Delegate Methods - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {      if (component == kBreadComponent)          return [self.breadTypes objectAtIndex:row];      return [self.fillingTypes objectAtIndex:row]; }
버튼클릭
DependentPickerView 를 만들어 봅시다 .  
plist 파일의 구조 (1)
plist 파일의 구조 (2)
- DependentComponentPickerViewController.h #import <UIKit/UIKit.h> #define kStateComponent   0 #define kZipComponent     1 @interface DependentComponentPickerViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource>  {       UIPickerView    *picker;      NSDictionary    *stateZips;      NSArray         *states;      NSArray         *zips; } @property (retain, nonatomic) IBOutlet UIPickerView *picker; @property (retain, nonatomic) NSDictionary *stateZips; @property (retain, nonatomic) NSArray *states; @property (retain, nonatomic) NSArray *zips; - (IBAction) buttonPressed; @end
- DependentComponentPickerViewController.m #import &quot;DependentComponentPickerViewController.h&quot; @implementation DependentComponentPickerViewController @synthesize picker; @synthesize stateZips; @synthesize states; @synthesize zips; - (IBAction) buttonPressed {      NSInteger stateRow = [picker selectedRowInComponent:kStateComponent];      NSInteger zipRow = [picker selectedRowInComponent:kZipComponent];      NSString *state = [self.states objectAtIndex:stateRow];      NSString *zip = [self.zips objectAtIndex:zipRow];      NSString *title = [[NSString alloc] initWithFormat:                         @&quot;You selected zip code %@.&quot;, zip];      NSString *message = [[NSString alloc] initWithFormat:                           @&quot;%@ is in %@&quot;, zip, state];      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title                                                      message:message                                                     delegate:nil                                            cancelButtonTitle:@&quot;OK&quot;                                            otherButtonTitles:nil];      [alert show];      [alert release];      [title release];      [message release]; }
- (void)viewDidLoad {      NSBundle *bundle = [NSBundle mainBundle];      NSString *plistPath = [bundle pathForResource:                             @&quot;statedictionary&quot; ofType:@&quot;plist&quot;];      NSDictionary *dictionary = [[NSDictionary alloc]                                  initWithContentsOfFile:plistPath];      self.stateZips = dictionary;      [dictionary release];      NSArray *components = [self.stateZips allKeys];      NSArray *sorted = [components sortedArrayUsingSelector:                         @selector(compare:)];      self.states = sorted;      NSString *selectedState = [self.states objectAtIndex:0];      NSArray *array = [stateZips objectForKey:selectedState];      self.zips = array; } - (void)viewDidUnload {      [super viewDidUnload];      // Release any retained subviews of the main view.      // e.g. self.myOutlet = nil;      self.picker = nil;      self.stateZips = nil;      self.states = nil;      self.zips = nil; }
- (void)dealloc {      [picker release];      [stateZips release];      [states release];      [zips release];      [super dealloc]; }
#pragma mark - #pragma mark Picker Data Source Methods - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {      return 2; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {      if (component == kStateComponent)          return [self.states count];      return [self.zips count]; } #pragma mark Picker Delegate Methods - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {      if (component == kStateComponent)          return [self.states objectAtIndex:row];      return [self.zips objectAtIndex:row]; } - (CGFloat)pickerView:(UIPickerView *)pickerView      widthForComponent:(NSInteger)component {      if (component == kZipComponent)          return 90;      return 200; }
- (void)pickerView:(UIPickerView *)pickerView    didSelectRow:(NSInteger)row         inComponent:(NSInteger)component {      if (component == kStateComponent) {          NSString *selectedState = [self.states objectAtIndex:row];          NSArray *array = [stateZips objectForKey:selectedState];          self.zips = array;          [picker selectRow:0 inComponent:kZipComponent animated:YES];          [picker reloadComponent:kZipComponent];      } }
버튼클릭
CustomPickerView 를 만들어 봅시다 .  
- CustomPickerViewController.h #import <UIKit/UIKit.h> #import <AudioToolbox/AudioToolbox.h> @interface CustomPickerViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate> {      UIPickerView *picker;      UILabel *winLabel;      NSArray *column1;      NSArray *column2;      NSArray *column3;      NSArray *column4;      NSArray *column5; UIButton *button; SystemSoundID crunchSoundID; SystemSoundID winSoundID; } @property(nonatomic, retain) IBOutlet UIPickerView *picker; @property(nonatomic, retain) IBOutlet UILabel *winLabel; @property(nonatomic, retain) NSArray *column1; @property(nonatomic, retain) NSArray *column2; @property(nonatomic, retain) NSArray *column3; @property(nonatomic, retain) NSArray *column4; @property(nonatomic, retain) NSArray *column5; @property(nonatomic, retain) IBOutlet UIButton *button; @property(nonatomic) SystemSoundID crunchSoundID; @property(nonatomic) SystemSoundID winSoundID; - (IBAction)spin; @end
#import &quot;CustomPickerViewController.h&quot; @implementation CustomPickerViewController @synthesize picker; @synthesize winLabel; @synthesize column1; @synthesize column2; @synthesize column3; @synthesize column4; @synthesize column5; @synthesize button; @synthesize crunchSoundID; @synthesize winSoundID; -(void)showButton {      button.hidden = NO; } -(void)playWinSound {      AudioServicesPlaySystemSound (winSoundID);      winLabel.text = @&quot;WIN!&quot;;      [self performSelector:@selector(showButton) withObject:nil    afterDelay:1.5]; }
- (IBAction)spin {      BOOL win = NO;      int numInRow = 1;      int lastVal = -1;      for (int i = 0; i < 5; i++) {          int newValue = random() % [self.column1 count];          if (newValue == lastVal)              numInRow++;          else              numInRow = 1;          lastVal = newValue;          [picker selectRow:newValue inComponent:i animated:YES];          [picker reloadComponent:i];          if (numInRow >= 3)              win = YES;      }      button.hidden = YES;      AudioServicesPlaySystemSound (crunchSoundID);      if (win)          [self performSelector:@selector(playWinSound)    withObject:nil    afterDelay:.5];      else          [self performSelector:@selector(showButton)    withObject:nil    afterDelay:.5];      winLabel.text = @&quot;&quot;;  }
- (void)viewDidLoad {      UIImage *seven = [UIImage imageNamed:@&quot;seven.png&quot;];      UIImage *bar = [UIImage imageNamed:@&quot;bar.png&quot;];      UIImage *crown = [UIImage imageNamed:@&quot;crown.png&quot;];      UIImage *cherry = [UIImage imageNamed:@&quot;cherry.png&quot;];      UIImage *lemon = [UIImage imageNamed:@&quot;lemon.png&quot;];      UIImage *apple = [UIImage imageNamed:@&quot;apple.png&quot;]; for (int i = 1; i <= 5; i++) {      UIImageView *sevenView = [[UIImageView alloc] initWithImage:seven];      UIImageView *barView = [[UIImageView alloc] initWithImage:bar];      UIImageView *crownView = [[UIImageView alloc] initWithImage:crown];      UIImageView *cherryView = [[UIImageView alloc]        initWithImage:cherry];      UIImageView *lemonView = [[UIImageView alloc] initWithImage:lemon];      UIImageView *appleView = [[UIImageView alloc] initWithImage:apple];      NSArray *imageViewArray = [[NSArray alloc] initWithObjects:    sevenView, barView, crownView, cherryView, lemonView,    appleView, nil]; NSString *fieldName = [[NSString alloc] initWithFormat:@&quot;column%d&quot;, i]; [self setValue:imageViewArray forKey:fieldName];
          [fieldName release];      [imageViewArray release];      [sevenView release];      [barView release];      [crownView release];      [cherryView release];      [lemonView release];      [appleView release]; } NSString *path = [[NSBundle mainBundle] pathForResource:@&quot;win&quot; ofType:@&quot;wav&quot;]; AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &winSoundID); path = [[NSBundle mainBundle] pathForResource:@&quot;crunch&quot; ofType:@&quot;wav&quot;]; AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &crunchSoundID); srandom(time(NULL)); }
- (void)viewDidUnload {      [super viewDidUnload];           self.picker = nil;      self.winLabel = nil;      self.column1 = nil;      self.column2 = nil;      self.column3 = nil;      self.column4 = nil;      self.column5 = nil;       self.button = nil; if (winSoundID)      AudioServicesDisposeSystemSoundID(winSoundID), winSoundID = 0; if (crunchSoundID)      AudioServicesDisposeSystemSoundID(crunchSoundID), crunchSoundID = 0; }
- (void)dealloc {      [picker release];      [winLabel release];      [column1 release];      [column2 release];      [column3 release];      [column4 release];      [column5 release];      [button release]; if (winSoundID)      AudioServicesDisposeSystemSoundID(winSoundID), winSoundID = 0; if (crunchSoundID)      AudioServicesDisposeSystemSoundID(crunchSoundID), crunchSoundID = 0;      [super dealloc]; }
#pragma mark - #pragma mark Picker Data Source Methods - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {      return 5; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {      return [self.column1 count]; } #pragma mark Picker Delegate Methods - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row            forComponent:(NSInteger)component reusingView:(UIView *)view {      NSString *arrayName = [[NSString alloc] initWithFormat:@&quot;column%d&quot;,    component+1];      NSArray *array = [self valueForKey:arrayName];      [arrayName release];      return [array objectAtIndex:row]; } @end
버튼클릭
Q & A  
감사합니다 . [email_address] 발표자 공지훈

Weitere ähnliche Inhalte

Was ist angesagt?

International News | World News
International News | World NewsInternational News | World News
International News | World Newsproductiveengin27
 
Your Second iPhone App - Code Listings
Your Second iPhone App - Code ListingsYour Second iPhone App - Code Listings
Your Second iPhone App - Code ListingsVu Tran Lam
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC Newswaggishwedge3973
 
Violet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole TeamViolet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole TeamAnton Caceres
 
Chapt 04 user interaction
Chapt 04 user interactionChapt 04 user interaction
Chapt 04 user interactionEdi Faizal
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC Newstalloration5719
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC Newsboorishvictim1493
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC Newsoceanicrainbow854
 
What Would You Do? With John Quinones
What Would You Do? With John QuinonesWhat Would You Do? With John Quinones
What Would You Do? With John Quinonesalertchair8725
 
Love and Loss: A Symfony Security Play
Love and Loss: A Symfony Security PlayLove and Loss: A Symfony Security Play
Love and Loss: A Symfony Security PlayKris Wallsmith
 
Politics News and U.S. Elections Coverage
Politics News and U.S. Elections CoveragePolitics News and U.S. Elections Coverage
Politics News and U.S. Elections Coveragealertchair8725
 
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tleFuture Processing
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC Newswonderfulshuttl70
 
Advanced jQuery
Advanced jQueryAdvanced jQuery
Advanced jQuerysergioafp
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony AppsKris Wallsmith
 

Was ist angesagt? (20)

201104 iphone navigation-based apps
201104 iphone navigation-based apps201104 iphone navigation-based apps
201104 iphone navigation-based apps
 
International News | World News
International News | World NewsInternational News | World News
International News | World News
 
Your Second iPhone App - Code Listings
Your Second iPhone App - Code ListingsYour Second iPhone App - Code Listings
Your Second iPhone App - Code Listings
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC News
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
 
Violet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole TeamViolet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole Team
 
Chapt 04 user interaction
Chapt 04 user interactionChapt 04 user interaction
Chapt 04 user interaction
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC News
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC News
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC News
 
What Would You Do? With John Quinones
What Would You Do? With John QuinonesWhat Would You Do? With John Quinones
What Would You Do? With John Quinones
 
Love and Loss: A Symfony Security Play
Love and Loss: A Symfony Security PlayLove and Loss: A Symfony Security Play
Love and Loss: A Symfony Security Play
 
Politics News and U.S. Elections Coverage
Politics News and U.S. Elections CoveragePolitics News and U.S. Elections Coverage
Politics News and U.S. Elections Coverage
 
Cyclejs introduction
Cyclejs introductionCyclejs introduction
Cyclejs introduction
 
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle
[Quality Meetup] M. Górski, M. Boś - Testy UI w Espresso z farmą w tle
 
jQuery Presentasion
jQuery PresentasionjQuery Presentasion
jQuery Presentasion
 
Technology and Science News - ABC News
Technology and Science News - ABC NewsTechnology and Science News - ABC News
Technology and Science News - ABC News
 
U.S. News | National News
U.S. News | National NewsU.S. News | National News
U.S. News | National News
 
Advanced jQuery
Advanced jQueryAdvanced jQuery
Advanced jQuery
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 

Andere mochten auch

Python3 10장 문자열이야기
Python3 10장 문자열이야기Python3 10장 문자열이야기
Python3 10장 문자열이야기Jihoon Kong
 
Python3 11장 날짜이야기
Python3 11장 날짜이야기Python3 11장 날짜이야기
Python3 11장 날짜이야기Jihoon Kong
 
10장 아이패드에 대한 고려사항
10장 아이패드에 대한 고려사항10장 아이패드에 대한 고려사항
10장 아이패드에 대한 고려사항Jihoon Kong
 
코어 로케이션
코어 로케이션코어 로케이션
코어 로케이션Jihoon Kong
 
Python3 6장 모듈만들기
Python3 6장 모듈만들기Python3 6장 모듈만들기
Python3 6장 모듈만들기Jihoon Kong
 
파이썬3 17장 파이썬과 인터넷
파이썬3 17장 파이썬과 인터넷파이썬3 17장 파이썬과 인터넷
파이썬3 17장 파이썬과 인터넷Jihoon Kong
 
소프트웨어와 인문학
소프트웨어와 인문학 소프트웨어와 인문학
소프트웨어와 인문학 Yong Joon Moon
 
파이썬 파일처리 이해하기
파이썬 파일처리 이해하기파이썬 파일처리 이해하기
파이썬 파일처리 이해하기Yong Joon Moon
 
파이썬 반복자 생성자 이해하기
파이썬 반복자 생성자 이해하기파이썬 반복자 생성자 이해하기
파이썬 반복자 생성자 이해하기Yong Joon Moon
 

Andere mochten auch (9)

Python3 10장 문자열이야기
Python3 10장 문자열이야기Python3 10장 문자열이야기
Python3 10장 문자열이야기
 
Python3 11장 날짜이야기
Python3 11장 날짜이야기Python3 11장 날짜이야기
Python3 11장 날짜이야기
 
10장 아이패드에 대한 고려사항
10장 아이패드에 대한 고려사항10장 아이패드에 대한 고려사항
10장 아이패드에 대한 고려사항
 
코어 로케이션
코어 로케이션코어 로케이션
코어 로케이션
 
Python3 6장 모듈만들기
Python3 6장 모듈만들기Python3 6장 모듈만들기
Python3 6장 모듈만들기
 
파이썬3 17장 파이썬과 인터넷
파이썬3 17장 파이썬과 인터넷파이썬3 17장 파이썬과 인터넷
파이썬3 17장 파이썬과 인터넷
 
소프트웨어와 인문학
소프트웨어와 인문학 소프트웨어와 인문학
소프트웨어와 인문학
 
파이썬 파일처리 이해하기
파이썬 파일처리 이해하기파이썬 파일처리 이해하기
파이썬 파일처리 이해하기
 
파이썬 반복자 생성자 이해하기
파이썬 반복자 생성자 이해하기파이썬 반복자 생성자 이해하기
파이썬 반복자 생성자 이해하기
 

Ähnlich wie Beginning iphone 4_devlopement_chpter7_tab_b

Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder BehindJohn Wilker
 
Model Driven App Development for iPhone and Android
Model Driven App Development for iPhone and AndroidModel Driven App Development for iPhone and Android
Model Driven App Development for iPhone and AndroidPeter Friese
 
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Sarp Erdag
 
303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Codejonmarimba
 
Formacion en movilidad: Conceptos de desarrollo en iOS (III)
Formacion en movilidad: Conceptos de desarrollo en iOS (III) Formacion en movilidad: Conceptos de desarrollo en iOS (III)
Formacion en movilidad: Conceptos de desarrollo en iOS (III) Mobivery
 
Pinned Sites IE 9 Lightup
Pinned Sites IE 9 LightupPinned Sites IE 9 Lightup
Pinned Sites IE 9 LightupWes Yanaga
 
jQuery for Sharepoint Dev
jQuery for Sharepoint DevjQuery for Sharepoint Dev
jQuery for Sharepoint DevZeddy Iskandar
 
Apple Templates Considered Harmful
Apple Templates Considered HarmfulApple Templates Considered Harmful
Apple Templates Considered HarmfulBrian Gesiak
 
Taking Objective-C to the next level. UA Mobile 2016.
Taking Objective-C to the next level. UA Mobile 2016.Taking Objective-C to the next level. UA Mobile 2016.
Taking Objective-C to the next level. UA Mobile 2016.UA Mobile
 
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろうUnity Technologies Japan K.K.
 
Cross platform mobile development
Cross platform mobile development Cross platform mobile development
Cross platform mobile development Alberto De Bortoli
 
Pimp My Web Page
Pimp My Web PagePimp My Web Page
Pimp My Web PageGage Choat
 
Conceitos e prática no desenvolvimento iOS - Mobile Conf 2014
Conceitos e prática no desenvolvimento iOS - Mobile Conf 2014Conceitos e prática no desenvolvimento iOS - Mobile Conf 2014
Conceitos e prática no desenvolvimento iOS - Mobile Conf 2014Fábio Pimentel
 

Ähnlich wie Beginning iphone 4_devlopement_chpter7_tab_b (20)

I os 11
I os 11I os 11
I os 11
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder Behind
 
Model Driven App Development for iPhone and Android
Model Driven App Development for iPhone and AndroidModel Driven App Development for iPhone and Android
Model Driven App Development for iPhone and Android
 
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
 
303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code
 
iOS
iOSiOS
iOS
 
Pioc
PiocPioc
Pioc
 
Formacion en movilidad: Conceptos de desarrollo en iOS (III)
Formacion en movilidad: Conceptos de desarrollo en iOS (III) Formacion en movilidad: Conceptos de desarrollo en iOS (III)
Formacion en movilidad: Conceptos de desarrollo en iOS (III)
 
Pinned Sites IE 9 Lightup
Pinned Sites IE 9 LightupPinned Sites IE 9 Lightup
Pinned Sites IE 9 Lightup
 
jQuery for Sharepoint Dev
jQuery for Sharepoint DevjQuery for Sharepoint Dev
jQuery for Sharepoint Dev
 
004
004004
004
 
Apple Templates Considered Harmful
Apple Templates Considered HarmfulApple Templates Considered Harmful
Apple Templates Considered Harmful
 
Taking Objective-C to the next level. UA Mobile 2016.
Taking Objective-C to the next level. UA Mobile 2016.Taking Objective-C to the next level. UA Mobile 2016.
Taking Objective-C to the next level. UA Mobile 2016.
 
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
 
iOS Training Session-3
iOS Training Session-3iOS Training Session-3
iOS Training Session-3
 
Cross platform mobile development
Cross platform mobile development Cross platform mobile development
Cross platform mobile development
 
WPF Controls
WPF ControlsWPF Controls
WPF Controls
 
Pimp My Web Page
Pimp My Web PagePimp My Web Page
Pimp My Web Page
 
Conceitos e prática no desenvolvimento iOS - Mobile Conf 2014
Conceitos e prática no desenvolvimento iOS - Mobile Conf 2014Conceitos e prática no desenvolvimento iOS - Mobile Conf 2014
Conceitos e prática no desenvolvimento iOS - Mobile Conf 2014
 
Advanced Silverlight
Advanced SilverlightAdvanced Silverlight
Advanced Silverlight
 

Kürzlich hochgeladen

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Kürzlich hochgeladen (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Beginning iphone 4_devlopement_chpter7_tab_b

  • 1.  
  • 2.
  • 3. 1. 피커 (Picker), 탭바 (Tab bars) 란 ?  
  • 4. (1)  피커 회전하는 다이얼이 들어있는 컨트롤 . (2) 탭바 하단에 버튼 영역 고정시켜 놓고 버튼을 선택함으로써 컨텐츠 영역을 바꾸는 컨트롤
  • 5. 2. 앞으로 만들어 볼 것들   
  • 6.  
  • 10. 3. 메인 탭바의 구성을 만들자 .  
  • 13.   - 개발 시나리오 (1) 다섯개의 탭이 들어가도록 기본 탭바를 만든다 . (2) 탭바에 아이콘 추가 (3) 데이트피커 , 단일 컴포넌트 피커 , 멀티 컴포넌트 피커 ,       의존컴포넌트를 활용한 피커 ,         이미지를 활용한 커스컴피커를 각 탭마다 추가한다 .
  • 14. 1. 프로젝트 명 Picker 로 생성 2. Group & files panel 최상단 폴더 선택후   command + n 클릭 3.
  • 15. 파일생성 및 각파일 생성 및 추가  그대로 next 하고 다음창도 next 저장할 이름은  &quot;DatePickerViewController&quot; 로 저장 . 그러면 확장자가 h,m,xib 파일 자동생성 이런식으로 SingleComponentPickerViewController DoubleComponentPickerViewController DependentComponentPickerViewController CustomPickerViewController  추가생성 supporting files 폴더 선택후 command+option+a 후 image,icon,music 파일 , 사전파일 import
  • 16. PickersAppDelegate.h #import <UIKit/UIKit.h> @interface PickersAppDelegate : NSObject <UIApplicationDelegate>  {       UIWindow *window;       UITabBarController *rootController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UITabBarController *rootController; @end
  • 17. PickersAppDelegate.m #import &quot;PickersAppDelegate.h&quot; @implementation PickersAppDelegate  @synthesize window;  @synthesize rootController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { } // Override point for customization after app launch [self.window addSubview:rootController.view]; [self.window makeKeyAndVisible]; return YES; - (void)dealloc { } @end [rootController release]; [window release]; [super dealloc];
  • 19.  
  • 20.  
  • 22. 4. 탭별 콤포넌트를 만들자 .  
  • 23.
  • 25. - DatePickerViewController.h #import <UIKit/UIKit.h>  @interface DatePickerViewController : UIViewController {      UIDatePicker *datePicker; } @property (nonatomic, retain) IBOutlet UIDatePicker *datePicker;   - (IBAction)buttonPressed;  @end
  • 26. DataPickerViewController.xib 를 선택해서  interfaceBuilder 를 연다 .
  • 27.  
  • 28. ctrl +  files'owner 선택 드래그 해서 datePicker 컴포넌트에 드랍
  • 29. 버튼 더블클릭 해서 이름 press 로 명명 버튼을 누르면 IBAction 함수가 호출되도록
  • 30. -  DatePickerViewController.m #import &quot;DatePickerViewController.h&quot; @implementation DatePickerViewController @synthesize datePicker; - (IBAction)buttonPressed  {       NSDate *selected = [datePicker date];       NSString *message = [[NSString alloc] initWithFormat:        @&quot;The date and time you selected is: %@&quot;, selected];       UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@&quot;Date and Time Selected&quot;                                                     message:message                                    delegate:nil cancelButtonTitle:@&quot;Yes, I did.&quot;                                     otherButtonTitles:nil];        [alert show];          [alert release];          [message release]; }
  • 31.   - (void)viewDidLoad  {      NSDate *now = [[NSDate alloc] init];     [datePicker setDate:now animated:NO];       [now release]; } - (void)viewDidUnload {       [super viewDidUnload];        self.datePicker = nil; } - (void)dealloc {      [datePicker release];      [super dealloc]; }
  • 34. - SingleComponentPickerViewController.h #import <UIKit/UIKit.h> @interface SingleComponentPickerViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource>   {       UIPickerView *singlePicker;     NSArray *pickerData;   } @property (nonatomic, retain) IBOutlet UIPickerView *singlePicker;  @property (nonatomic, retain) NSArray *pickerData;  - (IBAction)buttonPressed;  @end
  • 35. SinglePickerViewController.xib 를 선택해서  interfaceBuilder 를 연다 .
  • 36.  
  • 37. ctrl +  files'owner 선택 드래그 해서 singlePicker 컴포넌트에 드랍
  • 38. 버튼 더블클릭 해서 이름 press 로 명명 버튼을 누르면 IBAction 함수가 호출되도록
  • 39. - SingleComponentPickerViewController.m #import &quot;SingleComponentPickerViewController.h&quot; @implementation SingleComponentPickerViewController @synthesize singlePicker;  @synthesize pickerData; - (IBAction)buttonPressed  {     NSInteger row = [singlePicker selectedRowInComponent:0];       NSString *selected = [pickerData objectAtIndex:row];       NSString *title = [[NSString alloc] initWithFormat:@&quot;You selected %@!&quot;, selected];                                      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title                                        message:@&quot;Thank you for choosing.&quot;                                        delegate:nil                                        cancelButtonTitle:@&quot;You're Welcome&quot;                                                        otherButtonTitles:nil];      [alert show];       [alert release];       [title release]; }
  • 40. - (void)viewDidLoad {     NSArray *array = [[NSArray alloc] initWithObjects:@&quot;Luke&quot;, @&quot;Leia&quot;,   @&quot;Han&quot;, @&quot;Chewbacca&quot;, @&quot;Artoo&quot;, @&quot;Threepio&quot;, @&quot;Lando&quot;, nil];     self.pickerData = array;     [array release]; } - (void)viewDidUnload {     [super viewDidUnload];     // Release any retained subviews of the main view.     // e.g. self.myOutlet = nil;      self.singlePicker = nil;     self.pickerData = nil; } - (void)dealloc {     [singlePicker release];     [pickerData release];     [super dealloc]; }
  • 41. #pragma mark - #pragma mark Picker Data Source Methods - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {     return 1; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {     return [pickerData count]; } #pragma mark Picker Delegate Methods - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {     return [pickerData objectAtIndex:row]; }
  • 44. - DoubleComponentPickerViewController.h #import <UIKit/UIKit.h> #define kFillingComponent 0 #define kBreadComponent   1 @interface DoubleComponentPickerViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource> {     UIPickerView *doublePicker;     NSArray *fillingTypes;     NSArray *breadTypes; } @property(nonatomic, retain) IBOutlet UIPickerView *doublePicker; @property(nonatomic, retain) NSArray *fillingTypes; @property(nonatomic, retain) NSArray *breadTypes; -(IBAction)buttonPressed; @end
  • 45. - DoubleComponentPickerViewController.m #import &quot;DoubleComponentPickerViewController.h&quot; @implementation DoubleComponentPickerViewController @synthesize doublePicker; @synthesize fillingTypes; @synthesize breadTypes; -(IBAction)buttonPressed {     NSInteger fillingRow = [doublePicker selectedRowInComponent: kFillingComponent];     NSInteger breadRow = [doublePicker selectedRowInComponent:                           kBreadComponent];     NSString *bread = [breadTypes objectAtIndex:breadRow];     NSString *filling = [fillingTypes objectAtIndex:fillingRow];     NSString *message = [[NSString alloc] initWithFormat: @&quot;Your %@ on %@ bread will be right up.&quot;, filling, bread];     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:   @&quot;Thank you for your order&quot;                                                     message:message                                                    delegate:nil                                           cancelButtonTitle:@&quot;Great!&quot;                                           otherButtonTitles:nil];     [alert show];     [alert release];     [message release]; }
  • 46. - (void)viewDidLoad {     NSArray *fillingArray = [[NSArray alloc] initWithObjects:@&quot;Ham&quot;, @&quot;Turkey&quot;, @&quot;Peanut Butter&quot;, @&quot;Tuna Salad&quot;, @&quot;Nutella&quot;, @&quot;Roast Beef&quot;, @&quot;Vegemite&quot;, nil];     self.fillingTypes = fillingArray;     [fillingArray release];     NSArray *breadArray = [[NSArray alloc] initWithObjects:@&quot;White&quot;,   @&quot;Whole Wheat&quot;, @&quot;Rye&quot;, @&quot;Sourdough&quot;, @&quot;Seven Grain&quot;,nil];     self.breadTypes = breadArray;     [breadArray release]; } - (void)viewDidUnload {     [super viewDidUnload];     // Release any retained subviews of the main view.     // e.g. self.myOutlet = nil;      self.doublePicker = nil;     self.breadTypes = nil;     self.fillingTypes = nil; } - (void)dealloc {       [doublePicker release];     [breadTypes release];     [fillingTypes release];     [super dealloc]; }
  • 47. #pragma mark - #pragma mark Picker Data Source Methods - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {     return 2; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {     if (component == kBreadComponent)         return [self.breadTypes count];     return [self.fillingTypes count]; } #pragma mark Picker Delegate Methods - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {     if (component == kBreadComponent)         return [self.breadTypes objectAtIndex:row];     return [self.fillingTypes objectAtIndex:row]; }
  • 52. - DependentComponentPickerViewController.h #import <UIKit/UIKit.h> #define kStateComponent   0 #define kZipComponent     1 @interface DependentComponentPickerViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource> {     UIPickerView    *picker;     NSDictionary    *stateZips;     NSArray         *states;     NSArray         *zips; } @property (retain, nonatomic) IBOutlet UIPickerView *picker; @property (retain, nonatomic) NSDictionary *stateZips; @property (retain, nonatomic) NSArray *states; @property (retain, nonatomic) NSArray *zips; - (IBAction) buttonPressed; @end
  • 53. - DependentComponentPickerViewController.m #import &quot;DependentComponentPickerViewController.h&quot; @implementation DependentComponentPickerViewController @synthesize picker; @synthesize stateZips; @synthesize states; @synthesize zips; - (IBAction) buttonPressed {     NSInteger stateRow = [picker selectedRowInComponent:kStateComponent];     NSInteger zipRow = [picker selectedRowInComponent:kZipComponent];     NSString *state = [self.states objectAtIndex:stateRow];     NSString *zip = [self.zips objectAtIndex:zipRow];     NSString *title = [[NSString alloc] initWithFormat:                        @&quot;You selected zip code %@.&quot;, zip];     NSString *message = [[NSString alloc] initWithFormat:                          @&quot;%@ is in %@&quot;, zip, state];     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title                                                     message:message                                                    delegate:nil                                           cancelButtonTitle:@&quot;OK&quot;                                           otherButtonTitles:nil];     [alert show];     [alert release];     [title release];     [message release]; }
  • 54. - (void)viewDidLoad {     NSBundle *bundle = [NSBundle mainBundle];     NSString *plistPath = [bundle pathForResource:                            @&quot;statedictionary&quot; ofType:@&quot;plist&quot;];     NSDictionary *dictionary = [[NSDictionary alloc]                                 initWithContentsOfFile:plistPath];     self.stateZips = dictionary;     [dictionary release];     NSArray *components = [self.stateZips allKeys];     NSArray *sorted = [components sortedArrayUsingSelector:                        @selector(compare:)];     self.states = sorted;     NSString *selectedState = [self.states objectAtIndex:0];     NSArray *array = [stateZips objectForKey:selectedState];     self.zips = array; } - (void)viewDidUnload {     [super viewDidUnload];     // Release any retained subviews of the main view.     // e.g. self.myOutlet = nil;     self.picker = nil;     self.stateZips = nil;     self.states = nil;     self.zips = nil; }
  • 55. - (void)dealloc {      [picker release];      [stateZips release];      [states release];      [zips release];      [super dealloc]; }
  • 56. #pragma mark - #pragma mark Picker Data Source Methods - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {     return 2; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {     if (component == kStateComponent)         return [self.states count];     return [self.zips count]; } #pragma mark Picker Delegate Methods - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {     if (component == kStateComponent)         return [self.states objectAtIndex:row];     return [self.zips objectAtIndex:row]; } - (CGFloat)pickerView:(UIPickerView *)pickerView     widthForComponent:(NSInteger)component {     if (component == kZipComponent)         return 90;     return 200; }
  • 57. - (void)pickerView:(UIPickerView *)pickerView    didSelectRow:(NSInteger)row         inComponent:(NSInteger)component {      if (component == kStateComponent) {          NSString *selectedState = [self.states objectAtIndex:row];          NSArray *array = [stateZips objectForKey:selectedState];          self.zips = array;          [picker selectRow:0 inComponent:kZipComponent animated:YES];          [picker reloadComponent:kZipComponent];      } }
  • 60. - CustomPickerViewController.h #import <UIKit/UIKit.h> #import <AudioToolbox/AudioToolbox.h> @interface CustomPickerViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate> {     UIPickerView *picker;     UILabel *winLabel;     NSArray *column1;     NSArray *column2;     NSArray *column3;     NSArray *column4;     NSArray *column5; UIButton *button; SystemSoundID crunchSoundID; SystemSoundID winSoundID; } @property(nonatomic, retain) IBOutlet UIPickerView *picker; @property(nonatomic, retain) IBOutlet UILabel *winLabel; @property(nonatomic, retain) NSArray *column1; @property(nonatomic, retain) NSArray *column2; @property(nonatomic, retain) NSArray *column3; @property(nonatomic, retain) NSArray *column4; @property(nonatomic, retain) NSArray *column5; @property(nonatomic, retain) IBOutlet UIButton *button; @property(nonatomic) SystemSoundID crunchSoundID; @property(nonatomic) SystemSoundID winSoundID; - (IBAction)spin; @end
  • 61. #import &quot;CustomPickerViewController.h&quot; @implementation CustomPickerViewController @synthesize picker; @synthesize winLabel; @synthesize column1; @synthesize column2; @synthesize column3; @synthesize column4; @synthesize column5; @synthesize button; @synthesize crunchSoundID; @synthesize winSoundID; -(void)showButton {     button.hidden = NO; } -(void)playWinSound {     AudioServicesPlaySystemSound (winSoundID);     winLabel.text = @&quot;WIN!&quot;;     [self performSelector:@selector(showButton) withObject:nil   afterDelay:1.5]; }
  • 62. - (IBAction)spin {     BOOL win = NO;     int numInRow = 1;     int lastVal = -1;     for (int i = 0; i < 5; i++) {         int newValue = random() % [self.column1 count];         if (newValue == lastVal)             numInRow++;         else             numInRow = 1;         lastVal = newValue;         [picker selectRow:newValue inComponent:i animated:YES];         [picker reloadComponent:i];         if (numInRow >= 3)             win = YES;     }     button.hidden = YES;     AudioServicesPlaySystemSound (crunchSoundID);     if (win)         [self performSelector:@selector(playWinSound)   withObject:nil   afterDelay:.5];     else         [self performSelector:@selector(showButton)   withObject:nil   afterDelay:.5];     winLabel.text = @&quot;&quot;; }
  • 63. - (void)viewDidLoad {      UIImage *seven = [UIImage imageNamed:@&quot;seven.png&quot;];      UIImage *bar = [UIImage imageNamed:@&quot;bar.png&quot;];      UIImage *crown = [UIImage imageNamed:@&quot;crown.png&quot;];      UIImage *cherry = [UIImage imageNamed:@&quot;cherry.png&quot;];      UIImage *lemon = [UIImage imageNamed:@&quot;lemon.png&quot;];      UIImage *apple = [UIImage imageNamed:@&quot;apple.png&quot;]; for (int i = 1; i <= 5; i++) {      UIImageView *sevenView = [[UIImageView alloc] initWithImage:seven];      UIImageView *barView = [[UIImageView alloc] initWithImage:bar];      UIImageView *crownView = [[UIImageView alloc] initWithImage:crown];      UIImageView *cherryView = [[UIImageView alloc]       initWithImage:cherry];      UIImageView *lemonView = [[UIImageView alloc] initWithImage:lemon];      UIImageView *appleView = [[UIImageView alloc] initWithImage:apple];      NSArray *imageViewArray = [[NSArray alloc] initWithObjects:   sevenView, barView, crownView, cherryView, lemonView,   appleView, nil]; NSString *fieldName = [[NSString alloc] initWithFormat:@&quot;column%d&quot;, i]; [self setValue:imageViewArray forKey:fieldName];
  • 64.           [fieldName release];      [imageViewArray release];      [sevenView release];      [barView release];      [crownView release];      [cherryView release];      [lemonView release];      [appleView release]; } NSString *path = [[NSBundle mainBundle] pathForResource:@&quot;win&quot; ofType:@&quot;wav&quot;]; AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &winSoundID); path = [[NSBundle mainBundle] pathForResource:@&quot;crunch&quot; ofType:@&quot;wav&quot;]; AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &crunchSoundID); srandom(time(NULL)); }
  • 65. - (void)viewDidUnload {     [super viewDidUnload];           self.picker = nil;     self.winLabel = nil;     self.column1 = nil;     self.column2 = nil;     self.column3 = nil;     self.column4 = nil;     self.column5 = nil;      self.button = nil; if (winSoundID)     AudioServicesDisposeSystemSoundID(winSoundID), winSoundID = 0; if (crunchSoundID)     AudioServicesDisposeSystemSoundID(crunchSoundID), crunchSoundID = 0; }
  • 66. - (void)dealloc {     [picker release];     [winLabel release];     [column1 release];     [column2 release];     [column3 release];     [column4 release];     [column5 release];     [button release]; if (winSoundID)     AudioServicesDisposeSystemSoundID(winSoundID), winSoundID = 0; if (crunchSoundID)     AudioServicesDisposeSystemSoundID(crunchSoundID), crunchSoundID = 0;     [super dealloc]; }
  • 67. #pragma mark - #pragma mark Picker Data Source Methods - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {     return 5; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {     return [self.column1 count]; } #pragma mark Picker Delegate Methods - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row           forComponent:(NSInteger)component reusingView:(UIView *)view {     NSString *arrayName = [[NSString alloc] initWithFormat:@&quot;column%d&quot;,   component+1];     NSArray *array = [self valueForKey:arrayName];     [arrayName release];     return [array objectAtIndex:row]; } @end
  • 69. Q & A  
  • 70. 감사합니다 . [email_address] 발표자 공지훈