我有一個UIActionSheet
包含picker
和UIToolbar
。在UIToolBar上有一個完成按鈕。但是,當我旋轉Picker
組件並且在它停止旋轉之前,如果我點擊Done
按鈕,那麼我的UITextfiled
中沒有任何值。如果在選取器停止旋轉動畫後點擊Done
按鈕,那麼我將得到所選組件的值獲得空值如果我解僱UIPickerview的操作單與完成按鈕,同時選擇器spining
有什麼方法可以在停止動畫之前獲取項目的值...?
感謝
求解
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
UILabel *lbl = (UILabel *)view;
// Reuse the label if possible...
if ((lbl == nil) || ([lbl class] != [UILabel class])) {
CGRect frame = CGRectMake(0.0, 10.0, 250, 50);
lbl = [[[UILabel alloc] initWithFrame:frame] autorelease];
}
if (component == 0) {
lbl.textColor = [UIColor blackColor];
lbl.textAlignment=UITextAlignmentLeft;
lbl.backgroundColor = [UIColor clearColor];
lbl.text = [arrCountry objectAtIndex:row];
lbl.font=[UIFont boldSystemFontOfSize:14];
NSInteger clm1 = [pickerView2 selectedRowInComponent:component];
txtCountry.text = [arrCountry objectAtIndex:clm1];
countryCode=[arrCountryCode objectAtIndex:clm1];
}
return lbl;
}
也
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
txtCountry.text = [arrCountry objectAtIndex:row];
countryCode=[arrCountryCode objectAtIndex:row];
}
我發現用類型的東西在iPhone應用程序中的一個,這就是爲什麼我試圖做到這一點... :( –
我能解決與上述代表 –