#import [UIKit/UIKit.h]
@interface UISearchOrder : UIViewController
IBOutlet UILabel *lblOrderDateFrom;
IBOutlet UILabel *lblOrderDateTo;
IBOutlet UILabel *lblOrderCompDateFrom;
IBOutlet UILabel *lblOrderCompDateTo;
IBOutlet UIView *viewPicker;
IBOutlet UIPickerView *pickData;
}
-(IBAction) btnPaymentTouch:(id)sender;
-(IBAction) btnDonePickerTouch:(id)sender;
@end
//In main file
#import "UISearchOrder.h"
@implementation UISearchOrder
NSArray *picker_global, *arr_Payment;
- (void)viewDidLoad {
[super viewDidLoad];
arr_Payment = [[NSArray alloc] initWithObjects:@"All",@"Paid",@"Pending",nil];
}
-(IBAction) btnPaymentTouch:(id)sender
{
picker_global=arr_Payment;
[pickData reloadComponent:0];
viewPicker.hidden=NO;
}
-(IBAction) btnDonePickerTouch:(id)sender
{
lblPayment.text= [arr_Payment objectAtIndex:[pickData selectedRowInComponent:0]];
viewPicker.hidden = YES;
}
#pragma mark -
#pragma mark Picker View Methods
- (NSString*)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
return [picker_global objectAtIndex:row];
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
}
#pragma mark -
#pragma mark UIPickerViewDataSource methods
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
return [picker_global count];
}
No comments:
Post a Comment