- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
if (pickerView == vehicleNumberPicker) {
return ad.vehicleNumberArray.count;
}
else if(pickerView == intervalPicker)
{
return intervalList.count;
}
else
{
return reportList.count;
}
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1; // or 2 or more
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row
forComponent:(NSInteger)component
{
if (pickerView == vehicleNumberPicker) {
return ad.vehicleNumberArray[row];
}
else if(pickerView == intervalPicker)
{
return intervalList[row];
}
else
{
return reportList[row];
}
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
if (pickerView == vehicleNumberPicker) {
vehicleNumberString = [[NSString alloc]initWithFormat:@"%@",ad.vehicleNumberArray[row]];
self.vehicleNumberTextField.text = vehicleNumberString;
}
else if(pickerView == intervalPicker)
{
intervalString = [[NSString alloc]initWithFormat:@"%@",intervalList[row]];
self.intervalTextField.text = intervalString;
}
else
{
reportString =[[NSString alloc]initWithFormat:@"%@",reportList[row]];
self.reportsTextField.text = reportString;
}
// intervalString=[intervalList objectAtIndex:row];
// reportString=[intervalList objectAtIndex:row];
//
if ([intervalString isEqualToString:@"2 Hours"] || [_intervalTextField.text isEqualToString:@"2 Hours"]) {
timeStr=[NSNumber numberWithInt:120];
// _intervalLabel.text=intervalString;
}
else if ([intervalString isEqualToString:@"4 Hours"]){
timeStr=[NSNumber numberWithInt:240];
// _intervalLabel.text=intervalString;
}
else if ([intervalString isEqualToString:@"8 Hours"]){
timeStr=[NSNumber numberWithInt:480];
// _intervalLabel.text=intervalString;
}
if ([reportString isEqualToString:@"Stoppage Report"] || [_reportsTextField.text isEqualToString:@"Stoppage Report"]) {
stopStr=[NSNumber numberWithInt:1];
// _reportLabel.text=reportString;
}
else if ([reportString isEqualToString:@"Track Report"]) {
stopStr=[NSNumber numberWithInt:2];
// _reportLabel.text=reportString;
}
else
if ([reportString isEqualToString:@"Track History"]) {
stopStr=[NSNumber numberWithInt:3];
// _reportLabel.text=reportString;
}
}
if (pickerView == vehicleNumberPicker) {
return ad.vehicleNumberArray.count;
}
else if(pickerView == intervalPicker)
{
return intervalList.count;
}
else
{
return reportList.count;
}
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1; // or 2 or more
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row
forComponent:(NSInteger)component
{
if (pickerView == vehicleNumberPicker) {
return ad.vehicleNumberArray[row];
}
else if(pickerView == intervalPicker)
{
return intervalList[row];
}
else
{
return reportList[row];
}
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
if (pickerView == vehicleNumberPicker) {
vehicleNumberString = [[NSString alloc]initWithFormat:@"%@",ad.vehicleNumberArray[row]];
self.vehicleNumberTextField.text = vehicleNumberString;
}
else if(pickerView == intervalPicker)
{
intervalString = [[NSString alloc]initWithFormat:@"%@",intervalList[row]];
self.intervalTextField.text = intervalString;
}
else
{
reportString =[[NSString alloc]initWithFormat:@"%@",reportList[row]];
self.reportsTextField.text = reportString;
}
// intervalString=[intervalList objectAtIndex:row];
// reportString=[intervalList objectAtIndex:row];
//
if ([intervalString isEqualToString:@"2 Hours"] || [_intervalTextField.text isEqualToString:@"2 Hours"]) {
timeStr=[NSNumber numberWithInt:120];
// _intervalLabel.text=intervalString;
}
else if ([intervalString isEqualToString:@"4 Hours"]){
timeStr=[NSNumber numberWithInt:240];
// _intervalLabel.text=intervalString;
}
else if ([intervalString isEqualToString:@"8 Hours"]){
timeStr=[NSNumber numberWithInt:480];
// _intervalLabel.text=intervalString;
}
if ([reportString isEqualToString:@"Stoppage Report"] || [_reportsTextField.text isEqualToString:@"Stoppage Report"]) {
stopStr=[NSNumber numberWithInt:1];
// _reportLabel.text=reportString;
}
else if ([reportString isEqualToString:@"Track Report"]) {
stopStr=[NSNumber numberWithInt:2];
// _reportLabel.text=reportString;
}
else
if ([reportString isEqualToString:@"Track History"]) {
stopStr=[NSNumber numberWithInt:3];
// _reportLabel.text=reportString;
}
}
Sign up here with your email
ConversionConversion EmoticonEmoticon