2013-07-01 49 views

回答

0
- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated 

选择在选择器视图的特定成分的行。

Source

0

在按钮单击事件,您可以利用这一点。

  1. selectRow:inComponent:animated: - 帮助您在选取器中选择特定行。

  2. numberOfRowsInComponent: - 返回行的particluar组件的数量。

因此,要选择最后一个对象索引,可以使用这个。

[self.pickerView selectRow:[self.pickerView numberOfRowsInComponent:0] inComponent:0 animated:NO]; 
0

您可以下面的代码片段

[self.pickerView selectRow:MAX_VALUE inComponent:0 animated:NO]; 

where MAX_VALUE = total no. of rows in component - 1; 

喜欢编程这个使用做!