3
Comment puis-je aligner le titre de chaque ligne dans une UIPickerView à droite?Comment aligner le texte du titre de la vue du sélecteur sur chaque rangée à droite?
Merci d'avance.
Comment puis-je aligner le titre de chaque ligne dans une UIPickerView à droite?Comment aligner le texte du titre de la vue du sélecteur sur chaque rangée à droite?
Merci d'avance.
Vous pouvez implémenter la méthode du délégué pickerView:viewForRow:forComponent:reusingView:
et retourne une instance UILabel de lui:
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
UILabel* label = (UILabel*)view;
if (view == nil){
label= [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 190, 44)];
label.textAlignment = UITextAlignmentRight;
//Set other properties if you need like font, text color etc
...
}
label.text = [self textForRow:row forComponent:component];
return label;
}
Merci :). Ça a marché. –
très utile, grâce –
Pouvons-nous utiliser cette mentod en conjonction titleForRow: forComponent? – Ans