Vous implémentez le UIPickerDelegate, puis implémentez les méthodes qui appartiennent à UIPickerView.
Ainsi, votre fichier d'interface doit contenir ceci:
@interface YourViewController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource> {
Votre viewController les met en œuvre ces derniers, ou plus, des méthodes:
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component;
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;
- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;
t'You serait alors instancier le sélecteur, définir son délégué et toutes les autres propriétés dont vous avez besoin pour se conformer à.
Vous pouvez ensuite brancher un "écouteur" pour garder la trace lorsqu'il a changé.
[datePicker addTarget:self action:@selector(didChangeDate) forControlEvents:UIControlEventValueChanged];
Un bon point de départ est l'exemple UICatalog du site de développement Apple. Cela a beaucoup de code Picker et un tas d'autres choses qui pourraient aider à entrer dans la mentalité qu'Apple utilise pour construire des choses avec UIElements.
J'espère que ça aide :) c'est un sujet important.
thx pour répondre. Je comprends en utilisant UIPickerView. Ma question était comment je peux animer ou faire glisser une vue qui contient le UIPickerView et la barre d'outils à mi-chemin de l'écran au-dessus d'une autre vue. –