BGPPlanRegisterViewController.h
#import <UIKit/UIKit.h>
#import “PersonalDetailsViewController.h”
#import “ApplicationDetailsViewController.h”
#import “NominationDetailsViewController.h”
#import “AgreemnetDetailsViewController.h”
#import “PaymentDetailsViewController.h”
#import “BGPPlanRegisterDataModel.h”
@protocol bGPPlanRegisterViewControllerDelegate <NSObject>
– (void)collectDataAndPassDataIFromPersonalDetailsViewControllerToApplicationDetailsViewControllerDictionaryData:(NSDictionary *)dictionaryData;
@end
@interface BGPPlanRegisterViewController : UIViewController <UIPageViewControllerDelegate,UIPageViewControllerDataSource>
@property (nonatomic, assign) int integerViewControllerIndex;
@property (strong, nonatomic) UIPageViewController *pageViewController;
@property (weak, nonatomic) UIPageControl *pageControl;
@property (strong, nonatomic) NSArray *viewControllers;
@property (strong, nonatomic) BGPPlanRegisterDataModel *dataModelBGPPlanRegister;
@property (strong, nonatomic) PersonalDetailsViewController *personalDetailsViewControllerObj;
@property (strong, nonatomic) ApplicationDetailsViewController *applicationDetailsViewControllerObj;
@property (strong, nonatomic) NominationDetailsViewController *nominationDetailsViewControllerObj;
@property (strong, nonatomic) AgreemnetDetailsViewController *agreemnetDetailsViewControllerObj;
@property (strong, nonatomic) PaymentDetailsViewController *paymentDetailsViewControllerObj;
@property (nonatomic, weak) id<bGPPlanRegisterViewControllerDelegate> delegate;
@property (weak, nonatomic) IBOutlet UIView *viewProgressFirst;
@property (weak, nonatomic) IBOutlet UIView *viewProgressSecond;
@property (weak, nonatomic) IBOutlet UIView *viewProgressThird;
@property (weak, nonatomic) IBOutlet UIView *viewProgressFourth;
@property (weak, nonatomic) IBOutlet UIView *viewProgressFifth;
@property (weak, nonatomic) IBOutlet UIView *viewPageContainer;
@property (weak, nonatomic) IBOutlet UILabel *labelDetails;
@property (weak, nonatomic) IBOutlet UIButton *buttonPrevious;
@property (weak, nonatomic) IBOutlet UIButton *buttonNext;
@property (weak, nonatomic) IBOutlet UIButton *buttonSubmit;
– (IBAction)buttonActionPrevious:(id)sender;
– (IBAction)buttonActionNext:(id)sender;
– (IBAction)buttonActionSubmit:(id)sender;
@end
BGPPlanRegisterViewController.m
#import “BGPPlanRegisterViewController.h”
@interface BGPPlanRegisterViewController ()
@end
@implementation BGPPlanRegisterViewController
– (void)viewDidLoad {
[super viewDidLoad];
_dataModelBGPPlanRegister = [BGPPlanRegisterDataModel new];
_dataModelBGPPlanRegister.Auth_Token = @”USA”;
// Create page view controller
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll
navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
[self.pageViewController.view setFrame:[_viewPageContainer bounds]];
self.pageViewController.dataSource = self;
self.pageViewController.delegate = self;
_personalDetailsViewControllerObj = [[UIStoryboard storyboardWithName:@”BGPPlanRegisterStoryboard” bundle:nil]instantiateViewControllerWithIdentifier:@”PersonalDetailsViewController”];
_personalDetailsViewControllerObj.dataModelBGPPlanRegister = _dataModelBGPPlanRegister;
// _personalDetailsViewControllerObj.dataModelBGPPlanRegister = (BGPPlanRegisterDataModel *) @{@”Name”: @”BGPPlanRegisterViewController”};
_applicationDetailsViewControllerObj = [[UIStoryboard storyboardWithName:@”BGPPlanRegisterStoryboard” bundle:nil]instantiateViewControllerWithIdentifier:@”ApplicationDetailsViewController”];
_nominationDetailsViewControllerObj = [[UIStoryboard storyboardWithName:@”BGPPlanRegisterStoryboard” bundle:nil]instantiateViewControllerWithIdentifier:@”NominationDetailsViewController”];
_agreemnetDetailsViewControllerObj = [[UIStoryboard storyboardWithName:@”BGPPlanRegisterStoryboard” bundle:nil]instantiateViewControllerWithIdentifier:@”AgreemnetDetailsViewController”];
_paymentDetailsViewControllerObj = [[UIStoryboard storyboardWithName:@”BGPPlanRegisterStoryboard” bundle:nil]instantiateViewControllerWithIdentifier:@”PaymentDetailsViewController”];
_viewControllers = [NSArray arrayWithObjects:_personalDetailsViewControllerObj, _applicationDetailsViewControllerObj, _nominationDetailsViewControllerObj, _agreemnetDetailsViewControllerObj, _paymentDetailsViewControllerObj, nil];
_integerViewControllerIndex = 0;
NSArray *tutorialViews = @[[self viewControllerAtIndex:_integerViewControllerIndex]];
[self.pageViewController setViewControllers:tutorialViews direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
[self addChildViewController:_pageViewController];
[self.viewPageContainer addSubview:_pageViewController.view];
[self.pageViewController didMoveToParentViewController:self];
_buttonPrevious.hidden = YES;
_buttonSubmit.hidden = YES;
[self viewProgressHeighlightNumber:0];
// Do any additional setup after loading the view.
}
– (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark – Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
– (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
– (IBAction)buttonActionPrevious:(id)sender {
if (_integerViewControllerIndex == 1)
{
_buttonPrevious.hidden = YES;
}
if (_integerViewControllerIndex == 4) {
_buttonNext.hidden = NO;
_buttonSubmit.hidden = YES;
}
if (_integerViewControllerIndex >= 1) {
_integerViewControllerIndex –;
[self viewProgressHeighlightNumber:_integerViewControllerIndex];
NSArray *tutorialViews = @[[self viewControllerAtIndex:_integerViewControllerIndex]];
[self.pageViewController setViewControllers:tutorialViews direction:UIPageViewControllerNavigationDirectionReverse animated:NO completion:nil];
}
}
– (IBAction)buttonActionNext:(id)sender {
if (_integerViewControllerIndex == 0)
{
if (![_personalDetailsViewControllerObj shouldGoNextScreen])
{
return;
}
_buttonPrevious.hidden = NO;
_dataModelBGPPlanRegister = [_personalDetailsViewControllerObj collectDataInPersonalDetailsViewController];
_applicationDetailsViewControllerObj.dataModelBGPPlanRegister = _dataModelBGPPlanRegister;
}
else if (_integerViewControllerIndex == 1)
{
if (![_applicationDetailsViewControllerObj shouldGoNextScreen])
{
return;
}
_dataModelBGPPlanRegister = [_applicationDetailsViewControllerObj collectDataInApplicationDetailsViewController];
_nominationDetailsViewControllerObj.dataModelBGPPlanRegister = _dataModelBGPPlanRegister;
}
else if (_integerViewControllerIndex == 2)
{
if (![_nominationDetailsViewControllerObj shouldGoNextScreen])
{
return;
}
_dataModelBGPPlanRegister = [_nominationDetailsViewControllerObj collectDataInNominationDetailsViewController];
_agreemnetDetailsViewControllerObj.dataModelBGPPlanRegister = _dataModelBGPPlanRegister;
}
else if (_integerViewControllerIndex == 3)
{
if (![_agreemnetDetailsViewControllerObj shouldGoNextScreen])
{
return;
}
_dataModelBGPPlanRegister = [_agreemnetDetailsViewControllerObj collectDataInAgreemnetDetailsViewController];
_paymentDetailsViewControllerObj.dataModelBGPPlanRegister = _dataModelBGPPlanRegister;
_buttonSubmit.hidden = NO;
_buttonNext.hidden = YES;
}
else if (_integerViewControllerIndex == 4)
{
if (![_paymentDetailsViewControllerObj shouldGoNextScreen])
{
return;
}
_dataModelBGPPlanRegister = [_paymentDetailsViewControllerObj collectDataInPaymentDetailsViewController];
NSLog(@”%@”,[Utility descriptionForObject:_dataModelBGPPlanRegister]);
}
if (_integerViewControllerIndex <= 3) {
_integerViewControllerIndex ++;
[self viewProgressHeighlightNumber:_integerViewControllerIndex];
NSArray *viewControllersView = @[[self viewControllerAtIndex:_integerViewControllerIndex]];
[self.pageViewController setViewControllers:viewControllersView direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
}
}
– (IBAction)buttonActionSubmit:(id)sender {
}
– (UIViewController *)viewControllerAtIndex:(NSUInteger)index
{
// Create a new view controller and pass suitable data.
UIViewController *viewController = nil;
if (index == 0)
{
viewController = _personalDetailsViewControllerObj;
_labelDetails.text = @”Personal Details”;
}
else if (index == 1)
{
viewController = _applicationDetailsViewControllerObj;
_labelDetails.text = @”Application Details”;
}
else if (index == 2)
{
viewController = _nominationDetailsViewControllerObj;
_labelDetails.text = @”Nomination Details”;
}
else if (index == 3)
{
viewController = _agreemnetDetailsViewControllerObj;
_labelDetails.text = @”Agreement Details”;
}
else if (index == 4)
{
viewController = _paymentDetailsViewControllerObj;
_labelDetails.text = @”Payment Details”;
}
return viewController;
}
#pragma mark – Page View Controller Data Source
//- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController{
//
// if ([viewController isKindOfClass:[PersonalDetailsViewController class]]) {
// return [self viewControllerAtIndex:1];
// }
// else if ([viewController isKindOfClass:[ApplicationDetailsViewController class]])
// {
// return [self viewControllerAtIndex:2];
// }
// else
// {
// return nil;
// }
//
//}
//
//- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController{
//
// if ([viewController isKindOfClass:[NominationDetailsViewController class]]) {
// return [self viewControllerAtIndex:2];
// }
// else if ([viewController isKindOfClass:[ApplicationDetailsViewController class]]){
// return [self viewControllerAtIndex:1];
// }
// else{
// return nil;
// }
//
//}
– (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController
{
// For show Page Indicator
// return [self.pageTitles count];
// return 3;
return 0;
}
– (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController
{
return 0;
}
// called before the transition starts
– (void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray<UIViewController *> *)pendingViewControllers
{
NSLog(@”willTransitionToViewControllers”);
}
// called after the transition is finished
– (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray<UIViewController *> *)previousViewControllers transitionCompleted:(BOOL)completed
{
NSLog(@”transitionCompleted”);
}
– (void)collectDataInApplicationDetailsViewControllerDictionaryData:(NSDictionary *)dictionaryData
{
NSLog(@”%@”,dictionaryData);
}
– (void)viewProgressHeighlightNumber:(int)viewNumber
{
NSLog(@”%d”,viewNumber);
if (viewNumber == 0) {
_viewProgressFirst.backgroundColor = [UIColor colorWithRed:251/255.0 green:195/255.0 blue:0/255.0 alpha:1];
_viewProgressSecond.backgroundColor = [UIColor colorWithRed:196/255.0 green:196/255.0 blue:196/255.0 alpha:1];
_viewProgressThird.backgroundColor = [UIColor colorWithRed:196/255.0 green:196/255.0 blue:196/255.0 alpha:1];
_viewProgressFourth.backgroundColor = [UIColor colorWithRed:196/255.0 green:196/255.0 blue:196/255.0 alpha:1];
_viewProgressFifth.backgroundColor = [UIColor colorWithRed:196/255.0 green:196/255.0 blue:196/255.0 alpha:1];
}
else if (viewNumber == 1)
{
_viewProgressFirst.backgroundColor = [UIColor colorWithRed:145/255.0 green:202/255.0 blue:65/255.0 alpha:1];
_viewProgressSecond.backgroundColor = [UIColor colorWithRed:251/255.0 green:195/255.0 blue:0/255.0 alpha:1];
_viewProgressThird.backgroundColor = [UIColor colorWithRed:196/255.0 green:196/255.0 blue:196/255.0 alpha:1];
_viewProgressFourth.backgroundColor = [UIColor colorWithRed:196/255.0 green:196/255.0 blue:196/255.0 alpha:1];
_viewProgressFifth.backgroundColor = [UIColor colorWithRed:196/255.0 green:196/255.0 blue:196/255.0 alpha:1];
}
else if (viewNumber == 2)
{
_viewProgressFirst.backgroundColor = [UIColor colorWithRed:145/255.0 green:202/255.0 blue:65/255.0 alpha:1];
_viewProgressSecond.backgroundColor = [UIColor colorWithRed:145/255.0 green:202/255.0 blue:65/255.0 alpha:1];
_viewProgressThird.backgroundColor = [UIColor colorWithRed:251/255.0 green:195/255.0 blue:0/255.0 alpha:1];
_viewProgressFourth.backgroundColor = [UIColor colorWithRed:196/255.0 green:196/255.0 blue:196/255.0 alpha:1];
_viewProgressFifth.backgroundColor = [UIColor colorWithRed:196/255.0 green:196/255.0 blue:196/255.0 alpha:1];
}
else if (viewNumber == 3)
{
_viewProgressFirst.backgroundColor = [UIColor colorWithRed:145/255.0 green:202/255.0 blue:65/255.0 alpha:1];
_viewProgressSecond.backgroundColor = [UIColor colorWithRed:145/255.0 green:202/255.0 blue:65/255.0 alpha:1];
_viewProgressThird.backgroundColor = [UIColor colorWithRed:145/255.0 green:202/255.0 blue:65/255.0 alpha:1];
_viewProgressFourth.backgroundColor = [UIColor colorWithRed:251/255.0 green:195/255.0 blue:0/255.0 alpha:1];
_viewProgressFifth.backgroundColor = [UIColor colorWithRed:196/255.0 green:196/255.0 blue:196/255.0 alpha:1];
}
else if (viewNumber == 4)
{
_viewProgressFirst.backgroundColor = [UIColor colorWithRed:145/255.0 green:202/255.0 blue:65/255.0 alpha:1];
_viewProgressSecond.backgroundColor = [UIColor colorWithRed:145/255.0 green:202/255.0 blue:65/255.0 alpha:1];
_viewProgressThird.backgroundColor = [UIColor colorWithRed:145/255.0 green:202/255.0 blue:65/255.0 alpha:1];
_viewProgressFourth.backgroundColor = [UIColor colorWithRed:145/255.0 green:202/255.0 blue:65/255.0 alpha:1];
_viewProgressFifth.backgroundColor = [UIColor colorWithRed:251/255.0 green:195/255.0 blue:0/255.0 alpha:1];
}
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
[self.view endEditing:YES];// this will do the trick
}
@end
PersonalDetailsViewController.h
#import <UIKit/UIKit.h>
#import “Constant.h”
#import “Utility.h”
#import “BGPPlanRegisterDataModel.h”
@interface PersonalDetailsViewController : UIViewController<UITextFieldDelegate>
@property (strong, nonatomic) BGPPlanRegisterDataModel *dataModelBGPPlanRegister;
@property (strong, nonatomic) UITextField *textFieldActive;
@property (weak, nonatomic) IBOutlet UIButton *buttonMale;
@property (weak, nonatomic) IBOutlet UIButton *buttonFemale;
@property (weak, nonatomic) IBOutlet UITextField *textFieldName;
@property (weak, nonatomic) IBOutlet UITextField *textFieldEmailID;
@property (weak, nonatomic) IBOutlet UITextField *textFieldMobileNumber;
@property (weak, nonatomic) IBOutlet UILabel *labelDate;
@property (weak, nonatomic) IBOutlet UIDatePicker *datePicker;
@property (weak, nonatomic) IBOutlet UIView *viewDatePicker;
– (BGPPlanRegisterDataModel *)collectDataInPersonalDetailsViewController;
– (BOOL)shouldGoNextScreen;
– (IBAction)buttonActionMale:(id)sender;
– (IBAction)buttonActionFemale:(id)sender;
– (IBAction)buttonActionDate:(id)sender;
– (IBAction)datePickerAction:(id)sender;
@end
PersonalDetailsViewController.m
#import “PersonalDetailsViewController.h”
@interface PersonalDetailsViewController ()
@end
@implementation PersonalDetailsViewController
– (void)viewDidLoad {
[super viewDidLoad];
NSLog(@”%@”,[Utility descriptionForObject:_dataModelBGPPlanRegister]);
_buttonMale.selected = YES;
_labelDate.text = nil;
_viewDatePicker.hidden = YES;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleTapTapGestureRecognizerEvent:)];
[self.view addGestureRecognizer:tapGesture];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated
{
}
– (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark – Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
– (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
– (BGPPlanRegisterDataModel *)collectDataInPersonalDetailsViewController
{
// applicant_name;
// applicant_gender;
// contact_email;
// contact_mobile;
// applicant_dob;
NSString *stringMaleORFemale;
if (self.buttonMale.selected)
{
NSLog(@”Male”);
stringMaleORFemale = @”Male”;
}
else if(self.buttonFemale.selected)
{
NSLog(@”Female”);
stringMaleORFemale = @”Female”;
}
_dataModelBGPPlanRegister.applicant_name = _textFieldName.text;
_dataModelBGPPlanRegister.applicant_gender = stringMaleORFemale;
_dataModelBGPPlanRegister.contact_email = _textFieldEmailID.text;
_dataModelBGPPlanRegister.contact_mobile = _textFieldMobileNumber.text;
_dataModelBGPPlanRegister.applicant_dob = _labelDate.text;
return _dataModelBGPPlanRegister;
}
– (BOOL)shouldGoNextScreen
{
return [self isValidAllTextfield];
}
– (IBAction)buttonActionMale:(id)sender {
if (!_buttonMale.selected)
{
_buttonMale.selected = !_buttonMale.selected;
}
_buttonFemale.selected = NO;
}
– (IBAction)buttonActionFemale:(id)sender {
if (!_buttonFemale.selected)
{
_buttonFemale.selected = !_buttonFemale.selected;
}
_buttonMale.selected = NO;
}
– (IBAction)buttonActionDate:(id)sender {
_viewDatePicker.hidden = NO;
[_textFieldActive resignFirstResponder];
}
– (IBAction)datePickerAction:(id)sender {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@”dd/MM/yyyy”];
NSString *strDate = [dateFormatter stringFromDate:_datePicker.date];
_labelDate.text = strDate;
/*
//MM/DD/YYYY
NSDate *selectedDate = _datePicker.date;
NSDate * today = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@”MM/dd/yyy”];
NSString *selectedDateString = [formatter stringFromDate:selectedDate];
NSString *currentDateString = [formatter stringFromDate:today];
NSComparisonResult compResult = [today compare:selectedDate];
if ((compResult != NSOrderedAscending) &&
(NO == [currentDateString isEqualToString:selectedDateString])) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@”Invalid Move Date” message:@”Please select a valid Move date” delegate:nil cancelButtonTitle:@”OK” otherButtonTitles:nil];
[alertView show];
return;
}
*/
}
#pragma mark – TextField Delegate
– (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
// return NO to disallow editing.
return YES;
}
– (void)textFieldDidBeginEditing:(UITextField *)textField
{
// became first responder
_textFieldActive = textField;
_viewDatePicker.hidden = YES;
}
– (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
// return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end
return YES;
}
– (void)textFieldDidEndEditing:(UITextField *)textField
{
// may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called
[_textFieldActive resignFirstResponder];
}
– (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
// return NO to not change text
if (textField == _textFieldMobileNumber)
{
// Prevent crashing undo bug – see note below.
if(range.length + range.location > textField.text.length)
{
return NO;
}
NSUInteger newLength = [textField.text length] + [string length] – range.length;
return newLength <= 10;
}
else
{
return YES;
}
}
– (BOOL)textFieldShouldReturn:(UITextField *)textField
{
// called when ‘return’ key pressed. return NO to ignore.
[_textFieldActive resignFirstResponder];
return YES;
}
– (BOOL)isValidAllTextfield
{
[self.view endEditing:YES];
BOOL isValidate = NO;
if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldName.text].length == 0) {
[Utility showAlertControllerwithMessage:@”Please Enter Name”];
}
else if (![Utility isValidEmail:_textFieldEmailID.text])
{
[Utility showAlertControllerwithMessage:@”Please Enter valid Email ID”];
}
else if (![Utility isValidPhone:[@”+91″ stringByAppendingString:_textFieldMobileNumber.text]])
{
[Utility showAlertControllerwithMessage:@”Please Enter valid Phone Number”];
}
else if (_labelDate.text.length == 0)
{
[Utility showAlertControllerwithMessage:@”Please Select Date”];
}
else if (![Utility isAbow18PlusAgeDateOfBirth:_labelDate.text])
{
[Utility showAlertControllerwithMessage:@”You need to be 18+ years”];
}
else
{
isValidate = YES;
}
return isValidate;
}
#pragma mark –
– (void)handleTapTapGestureRecognizerEvent:(UITapGestureRecognizer *)recognizer
{
[_textFieldActive resignFirstResponder];
_viewDatePicker.hidden = YES;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@”dd/MM/yyyy”];
NSString *strDate = [dateFormatter stringFromDate:_datePicker.date];
_labelDate.text = strDate;
}
@end
ApplicationDetailsViewController.h
#import <UIKit/UIKit.h>
#import “BGPPlanRegisterDataModel.h”
#import “Utility.h”
@interface ApplicationDetailsViewController : UIViewController<UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource,UIAlertViewDelegate>
@property (strong, nonatomic) BGPPlanRegisterDataModel *dataModelBGPPlanRegister;
@property (strong, nonatomic) UITextField *textFieldActive;
@property (strong, nonatomic) NSMutableArray *arrayTableViewData;
@property (strong, nonatomic) NSString *stringFulfilment;
@property (strong, nonatomic) NSString *stringLeadSourceOther;
@property (assign, nonatomic) BOOL isReferanceDefault;
@property (assign, nonatomic) BOOL isReferanceOther;
@property (weak, nonatomic) IBOutlet UIButton *buttonDimonsJewellery;
@property (weak, nonatomic) IBOutlet UIButton *buttonGoldJewellery;
@property (weak, nonatomic) IBOutlet UIButton *buttonGoldPendent;
@property (weak, nonatomic) IBOutlet UITextField *textFieldReferalID;
@property (weak, nonatomic) IBOutlet UILabel *labelReferance;
@property (weak, nonatomic) IBOutlet UITextField *textFieldMailingAddress;
@property (weak, nonatomic) IBOutlet UITextField *textFieldCity;
@property (weak, nonatomic) IBOutlet UITextField *textFieldState;
@property (weak, nonatomic) IBOutlet UITextField *textFieldLandmark;
@property (weak, nonatomic) IBOutlet UITextField *textFieldDistrict;
@property (weak, nonatomic) IBOutlet UITextField *textFieldCountry;
@property (weak, nonatomic) IBOutlet UITextField *textFieldPinCode;
@property (weak, nonatomic) IBOutlet UITextField *textFieldLandLine;
@property (weak, nonatomic) IBOutlet UITextField *textFieldOfficeNumber;
@property (weak, nonatomic) IBOutlet UITextField *textFieldMobileNumber;
@property (weak, nonatomic) IBOutlet UITextField *textFieldEmailID;
@property (weak, nonatomic) IBOutlet UIButton *buttonIAgree;
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UIView *viewPopUpBelowTable;
@property (weak, nonatomic) IBOutlet UITableView *tableViewPopUp;
@property (weak, nonatomic) IBOutlet UIImageView *imagaeViewDropDown;
@property (weak, nonatomic) IBOutlet UIView *viewMain;
– (BGPPlanRegisterDataModel *)collectDataInApplicationDetailsViewController;
– (BOOL)shouldGoNextScreen;
– (IBAction)buttonActionDimondJewellery:(id)sender;
– (IBAction)buttonActionGoldJewellery:(id)sender;
– (IBAction)buttonActionGoldPendent:(id)sender;
– (IBAction)buttonActionReferance:(id)sender;
– (IBAction)buttonActionIAgree:(id)sender;
@end
ApplicationDetailsViewController.m
#import “ApplicationDetailsViewController.h”
@interface ApplicationDetailsViewController ()
@end
@implementation ApplicationDetailsViewController
– (void)viewDidLoad {
[super viewDidLoad];
NSLog(@”%@”,[Utility descriptionForObject:_dataModelBGPPlanRegister]);
_stringFulfilment = @”Coin”;
_buttonDimonsJewellery.selected = YES;
_arrayTableViewData = [[NSMutableArray alloc]initWithObjects:@”Website”,@”Social Media”,@”Mobile App”,@”Newspaper”,@”Friend”,@”Other”, nil];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleTapTapGestureRecognizerEvent:)];
[_viewMain addGestureRecognizer:tapGesture];
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTapGesture:)];
[_viewPopUpBelowTable addGestureRecognizer:tapGestureRecognizer];
[_tableViewPopUp.layer setCornerRadius:4.0f];
[_tableViewPopUp.layer setMasksToBounds:YES];
_tableViewPopUp.separatorStyle = UITableViewCellSeparatorStyleNone;
_textFieldMobileNumber.text = _dataModelBGPPlanRegister.contact_mobile;
_textFieldEmailID.text = _dataModelBGPPlanRegister.contact_email;
_isReferanceDefault = YES;
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated
{
_tableViewPopUp.hidden = YES;
_viewPopUpBelowTable.hidden = YES;
}
– (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark – Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
– (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
– (BGPPlanRegisterDataModel *)collectDataInApplicationDetailsViewController
{
// fulfilment;
// partner_code;
// lead_source;
// lead_source_other
// mailing_address;
// mailing_city;
// mailing_state;
// mailing_landmark;
// mailing_district;
// mailing_country;
// mailing_pincode;
// contact_phone_residence;
// contact_phone_office;
_dataModelBGPPlanRegister.fulfilment = _stringFulfilment;
_dataModelBGPPlanRegister.partner_code = _textFieldReferalID.text;
if (_isReferanceDefault)
{
_dataModelBGPPlanRegister.lead_source = _labelReferance.text;
}
else if (_isReferanceOther)
{
_dataModelBGPPlanRegister.lead_source_other = _labelReferance.text;
}
_dataModelBGPPlanRegister.mailing_address = _textFieldMailingAddress.text;
_dataModelBGPPlanRegister.mailing_city = _textFieldCity.text;
_dataModelBGPPlanRegister.mailing_state = _textFieldState.text;
_dataModelBGPPlanRegister.mailing_landmark = _textFieldLandmark.text;
_dataModelBGPPlanRegister.mailing_district = _textFieldDistrict.text;
_dataModelBGPPlanRegister.mailing_country = _textFieldCountry.text;
_dataModelBGPPlanRegister.mailing_pincode = _textFieldPinCode.text;
_dataModelBGPPlanRegister.contact_phone_residence = _textFieldLandLine.text;
_dataModelBGPPlanRegister.contact_phone_office = _textFieldOfficeNumber.text;
return _dataModelBGPPlanRegister;
}
– (BOOL)shouldGoNextScreen
{
BOOL canGoNextScreen = NO;
if ([self isValidAllTextfield])
{
if (_buttonIAgree.selected)
{
canGoNextScreen = YES;
}
else
{
[Utility showAlertControllerwithMessage:@”Please Tick Agreement Check Box”];
}
}
return canGoNextScreen;
}
– (IBAction)buttonActionDimondJewellery:(id)sender
{
[self tickMarkOnButtonAtIndex:1];
}
– (IBAction)buttonActionGoldJewellery:(id)sender
{
[self tickMarkOnButtonAtIndex:2];
}
– (IBAction)buttonActionGoldPendent:(id)sender
{
[self tickMarkOnButtonAtIndex:3];
}
– (IBAction)buttonActionReferance:(id)sender
{
_viewPopUpBelowTable.hidden = NO;
_tableViewPopUp.hidden = NO;
// _tableViewPopUp.frame = CGRectMake(_labelReferance.frame.origin.x, _labelReferance.frame.origin.y, _labelReferance.frame.size.width – _imagaeViewDropDown.frame.size.width, (HT/15.0*(_arrayTableViewData.count)));
_tableViewPopUp.frame = CGRectMake(_tableViewPopUp.frame.origin.x, _tableViewPopUp.frame.origin.y, _tableViewPopUp.frame.size.width, (HT/15.0*(_arrayTableViewData.count)));
}
– (IBAction)buttonActionIAgree:(id)sender
{
_buttonIAgree.selected = !_buttonIAgree.selected;
}
#pragma mark – TextField Delegate
– (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
// return NO to disallow editing.
return YES;
}
– (void)textFieldDidBeginEditing:(UITextField *)textField
{
// became first responder
_textFieldActive = textField;
// if (_textFieldActive != _textFieldReferalID && _textFieldActive != _textFieldMailingAddress) {
// // iPhone = -210
// // iPad = -230
// [self viewUpDownWithAnimationYCoordinate:-230];
// }
}
– (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
// return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end
return YES;
}
– (void)textFieldDidEndEditing:(UITextField *)textField
{
// may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called
[_textFieldActive resignFirstResponder];
}
– (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
// return NO to not change text
if (textField == _textFieldPinCode)
{
// Prevent crashing undo bug – see note below.
if(range.length + range.location > textField.text.length)
{
return NO;
}
NSUInteger newLength = [textField.text length] + [string length] – range.length;
return newLength <= 6;
}
else
{
return YES;
}
}
– (BOOL)textFieldShouldReturn:(UITextField *)textField
{
// called when ‘return’ key pressed. return NO to ignore.
[_textFieldActive resignFirstResponder];
return YES;
}
– (BOOL)isValidAllTextfield
{
[self.view endEditing:YES];
BOOL isValidate = NO;
if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldCity.text].length == 0) {
[Utility showAlertControllerwithMessage:@”Please Enter City Name”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldState.text].length == 0) {
[Utility showAlertControllerwithMessage:@”Please Enter State Name”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldDistrict.text].length == 0) {
[Utility showAlertControllerwithMessage:@”Please Enter District Name”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldPinCode.text].length == 0) {
[Utility showAlertControllerwithMessage:@”Please Enter Pincode”];
}
else
{
isValidate = YES;
}
return isValidate;
}
– (void)handleTapTapGestureRecognizerEvent:(UITapGestureRecognizer *)recognizer
{
[_textFieldActive resignFirstResponder];
}
– (void)tickMarkOnButtonAtIndex:(int)selectedButton
{
_buttonDimonsJewellery.selected = NO;
_buttonGoldJewellery.selected = NO;
_buttonGoldPendent.selected = NO;
if (selectedButton == 1)
{
_buttonDimonsJewellery.selected = YES;
_stringFulfilment = @”Coin”;
}
else if (selectedButton == 2)
{
_buttonGoldJewellery.selected = YES;
_stringFulfilment = @”Jewellery”;
}
else if (selectedButton == 3)
{
_buttonGoldPendent.selected = YES;
_stringFulfilment = @”Pendant”;
}
}
#pragma mark – View Popup
#pragma mark – TableView Delegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [_arrayTableViewData count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@”cellTableView”];
cell.textLabel.text = [_arrayTableViewData objectAtIndex:indexPath.row];
cell.backgroundColor = [UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
-(void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
// view.tintColor = [UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1];
}
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return @””;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 0.0;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return HT/15.0;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == [_arrayTableViewData count]-1)
{
NSLog(@”Other Selected”);
_viewPopUpBelowTable.hidden = YES;
_tableViewPopUp.hidden = YES;
_isReferanceDefault = NO;
_isReferanceOther = YES;
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:nil
message:@”Enter Other Referance”
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@”OK”, nil];
alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
[alertView show];
// UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@”Enter Referance”
// message:nil
// preferredStyle:UIAlertControllerStyleAlert];
// [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
// // optionally configure the text field
// textField.keyboardType = UIKeyboardTypeDefault;
// }];
//
// UIAlertAction *okAction = [UIAlertAction actionWithTitle:@”OK”
// style:UIAlertActionStyleDefault
// handler:^(UIAlertAction *action) {
// UITextField *textFieldEnterOtherReferance = [alertController.textFields firstObject];
// NSLog(@”%@”,textFieldEnterOtherReferance.text);
// if ([Utility trimString_RemoveWhiteSpaceFromString:textFieldEnterOtherReferance.text].length != 0)
// {
// _labelReferance.text = textFieldEnterOtherReferance.text;
// }
// }];
// [alertController addAction:okAction];
// [self presentViewController:alertController animated:YES completion:nil];
}
else
{
_labelReferance.text = [_arrayTableViewData objectAtIndex:indexPath.row];
_viewPopUpBelowTable.hidden = YES;
_tableViewPopUp.hidden = YES;
_isReferanceDefault = YES;
_isReferanceOther = NO;
}
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@”%@”,[alertView textFieldAtIndex:0].text);
_labelReferance.text = [alertView textFieldAtIndex:0].text;
}
-(void)handleTapGesture:(UITapGestureRecognizer *)tapGestureRecognizer
{
_viewPopUpBelowTable.hidden = YES;
_tableViewPopUp.hidden = YES;
}
@end
NominationDetailsViewController.h
#import <UIKit/UIKit.h>
#import “BGPPlanRegisterDataModel.h”
#import “Utility.h”
@interface NominationDetailsViewController : UIViewController<UITextFieldDelegate>
@property (strong, nonatomic) BGPPlanRegisterDataModel *dataModelBGPPlanRegister;
@property (strong, nonatomic) UITextField *textFieldActive;
@property (weak, nonatomic) IBOutlet UITextField *textFieldName;
@property (weak, nonatomic) IBOutlet UILabel *labelDate;
@property (weak, nonatomic) IBOutlet UITextField *textFieldRelationshipWithApplicant;
@property (weak, nonatomic) IBOutlet UIButton *buttonAddressSame;
@property (weak, nonatomic) IBOutlet UITextField *textFieldAddress;
@property (weak, nonatomic) IBOutlet UITextField *textFieldCity;
@property (weak, nonatomic) IBOutlet UITextField *textFieldState;
@property (weak, nonatomic) IBOutlet UITextField *textFieldPincode;
@property (weak, nonatomic) IBOutlet UIView *viewDatePicker;
@property (weak, nonatomic) IBOutlet UIDatePicker *datePicker;
– (BGPPlanRegisterDataModel *)collectDataInNominationDetailsViewController;
– (BOOL)shouldGoNextScreen;
– (IBAction)buttonActionDate:(id)sender;
– (IBAction)buttonActionAddressSame:(id)sender;
– (IBAction)datePickerAction:(id)sender;
@end
NominationDetailsViewController.m
#import “NominationDetailsViewController.h”
@interface NominationDetailsViewController ()
@end
@implementation NominationDetailsViewController
– (void)viewDidLoad {
[super viewDidLoad];
NSLog(@”%@”,[Utility descriptionForObject:_dataModelBGPPlanRegister]);
_viewDatePicker.hidden = YES;
_labelDate.text = nil;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleTapTapGestureRecognizerEvent:)];
[self.view addGestureRecognizer:tapGesture];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated
{
}
– (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark – Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
– (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
– (BGPPlanRegisterDataModel *)collectDataInNominationDetailsViewController
{
// nomination_name;
// nomination_dob;
// nomination_applicant_realtion;
// nomination_address;
// nomination_city;
// nomination_state;
// nomination_pincode;
_dataModelBGPPlanRegister.nomination_name = _textFieldName.text;
_dataModelBGPPlanRegister.nomination_dob = _labelDate.text;
_dataModelBGPPlanRegister.nomination_applicant_realtion = _textFieldRelationshipWithApplicant.text;
_dataModelBGPPlanRegister.nomination_address = _textFieldAddress.text;
_dataModelBGPPlanRegister.nomination_city = _textFieldCity.text;
_dataModelBGPPlanRegister.nomination_state = _textFieldState.text;
_dataModelBGPPlanRegister.nomination_pincode = _textFieldPincode.text;
return _dataModelBGPPlanRegister;
}
– (BOOL)shouldGoNextScreen
{
return [self isValidAllTextfield];
}
#pragma mark – TextField Delegate
– (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
// return NO to disallow editing_dataModelBGPPlanRegister.
return YES;
}
– (void)textFieldDidBeginEditing:(UITextField *)textField
{
// became first responder
_textFieldActive = textField;
_viewDatePicker.hidden = YES;
}
– (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
// return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end
return YES;
}
– (void)textFieldDidEndEditing:(UITextField *)textField
{
// may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called
[_textFieldActive resignFirstResponder];
}
– (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
// return NO to not change text
if (textField == _textFieldPincode)
{
// Prevent crashing undo bug – see note below.
if(range.length + range.location > textField.text.length)
{
return NO;
}
NSUInteger newLength = [textField.text length] + [string length] – range.length;
return newLength <= 6;
}
else
{
return YES;
}
}
– (BOOL)textFieldShouldReturn:(UITextField *)textField
{
// called when ‘return’ key pressed. return NO to ignore.
[_textFieldActive resignFirstResponder];
return YES;
}
– (BOOL)isValidAllTextfield
{
[self.view endEditing:YES];
// BOOL isValidate = NO;
//
// if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldName.text].length == 0) {
// [Utility showAlertControllerwithMessage:@”Please Enter Name”];
// }
// else if (![Utility isValidEmail:_textFieldEmailID.text])
// {
// [Utility showAlertControllerwithMessage:@”Please Enter valid Email ID”];
// }
// else if (![Utility isValidPhone:[@”+91″ stringByAppendingString:_textFieldMobileNumber.text]])
// {
// [Utility showAlertControllerwithMessage:@”Please Enter valid Phone Number”];
// }
// else if (_labelDate.text.length == 0)
// {
// [Utility showAlertControllerwithMessage:@”Please Select Date”];
// }
// else
// {
// isValidate = YES;
// }
return YES;
}
#pragma mark –
– (void)handleTapTapGestureRecognizerEvent:(UITapGestureRecognizer *)recognizer
{
[_textFieldActive resignFirstResponder];
_viewDatePicker.hidden = YES;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@”dd/MM/yyyy”];
NSString *strDate = [dateFormatter stringFromDate:_datePicker.date];
_labelDate.text = strDate;
}
– (IBAction)buttonActionDate:(id)sender {
_viewDatePicker.hidden = NO;
[_textFieldActive resignFirstResponder];
}
– (IBAction)buttonActionAddressSame:(id)sender
{
_buttonAddressSame.selected = !_buttonAddressSame.selected;
if (_buttonAddressSame.selected)
{
_textFieldAddress.enabled = NO;
_textFieldCity.enabled = NO;
_textFieldState.enabled = NO;
_textFieldPincode.enabled = NO;
_textFieldAddress.text = _dataModelBGPPlanRegister.mailing_address;
_textFieldCity.text = _dataModelBGPPlanRegister.mailing_city;
_textFieldState.text = _dataModelBGPPlanRegister.mailing_state;
_textFieldPincode.text = _dataModelBGPPlanRegister.mailing_pincode;
}
else
{
_textFieldAddress.enabled = YES;
_textFieldCity.enabled = YES;
_textFieldState.enabled = YES;
_textFieldPincode.enabled = YES;
_textFieldAddress.text = @””;
_textFieldCity.text = @””;
_textFieldState.text = @””;
_textFieldPincode.text = @””;
}
}
– (IBAction)datePickerAction:(id)sender {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@”dd/MM/yyyy”];
NSString *strDate = [dateFormatter stringFromDate:_datePicker.date];
_labelDate.text = strDate;
}
@end
AgreemnetDetailsViewController.h
#import <UIKit/UIKit.h>
#import “BGPPlanRegisterDataModel.h”
#import “Utility.h”
@interface AgreemnetDetailsViewController : UIViewController
@property (strong, nonatomic) BGPPlanRegisterDataModel *dataModelBGPPlanRegister;
@property (strong, nonatomic) UITextField *textFieldActive;
@property (weak, nonatomic) IBOutlet UIButton *buttonAcceptTC;
@property (weak, nonatomic) IBOutlet UITextField *textFieldDate;
@property (weak, nonatomic) IBOutlet UITextField *textFieldPlace;
@property (weak, nonatomic) IBOutlet UIView *viewAcceptTC;
@property (weak, nonatomic) IBOutlet UIView *viewIProposeTo;
@property (weak, nonatomic) IBOutlet UIView *viewDate;
@property (weak, nonatomic) IBOutlet UIButton *buttonShowTC;
@property (weak, nonatomic) IBOutlet UIView *viewMain;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutConstraintsViewDateTop999;
– (BGPPlanRegisterDataModel *)collectDataInAgreemnetDetailsViewController;
– (BOOL)shouldGoNextScreen;
– (IBAction)buttonActionAcceptTC:(id)sender;
– (IBAction)buttonActionShowTC:(id)sender;
@end
AgreemnetDetailsViewController.m
#import “AgreemnetDetailsViewController.h”
@interface AgreemnetDetailsViewController ()
@end
@implementation AgreemnetDetailsViewController
– (void)viewDidLoad {
[super viewDidLoad];
NSLog(@”%@”,[Utility descriptionForObject:_dataModelBGPPlanRegister]);
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleTapTapGestureRecognizerEvent:)];
[self.view addGestureRecognizer:tapGesture];
_viewIProposeTo.hidden = YES;
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated
{
}
– (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark – Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
– (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
– (BGPPlanRegisterDataModel *)collectDataInAgreemnetDetailsViewController
{
// declaration_date;
// declaration_place;
_dataModelBGPPlanRegister.declaration_date = _textFieldDate.text;
_dataModelBGPPlanRegister.declaration_place = _textFieldPlace.text;
return _dataModelBGPPlanRegister;
}
– (BOOL)shouldGoNextScreen
{
BOOL canGoNextScreen = NO;
if ([self isValidAllTextfield])
{
if (_buttonAcceptTC.selected)
{
canGoNextScreen = YES;
}
else
{
[Utility showAlertControllerwithMessage:@”Kindly accept the agreement”];
}
}
return canGoNextScreen;
}
#pragma mark – TextField Delegate
– (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
// return NO to disallow editing.
return YES;
}
– (void)textFieldDidBeginEditing:(UITextField *)textField
{
// became first responder
_textFieldActive = textField;
}
– (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
// return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end
return YES;
}
– (void)textFieldDidEndEditing:(UITextField *)textField
{
// may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called
[_textFieldActive resignFirstResponder];
}
– (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
// return NO to not change text
return YES;
}
– (BOOL)textFieldShouldReturn:(UITextField *)textField
{
// called when ‘return’ key pressed. return NO to ignore.
[_textFieldActive resignFirstResponder];
return YES;
}
– (BOOL)isValidAllTextfield
{
[self.view endEditing:YES];
BOOL isValidate = NO;
if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldPlace.text].length == 0) {
[Utility showAlertControllerwithMessage:@”Please Enter Place”];
}
else
{
isValidate = YES;
}
return isValidate;
}
#pragma mark –
– (void)handleTapTapGestureRecognizerEvent:(UITapGestureRecognizer *)recognizer
{
[_textFieldActive resignFirstResponder];
}
– (IBAction)buttonActionAcceptTC:(id)sender
{
_buttonAcceptTC.selected = !_buttonAcceptTC.selected;
}
– (IBAction)buttonActionShowTC:(id)sender
{
_buttonShowTC.selected = !_buttonShowTC.selected;
if (_buttonShowTC.selected)
{
_layoutConstraintsViewDateTop999.priority = 748;
_viewIProposeTo.hidden = NO;
}
else
{
_layoutConstraintsViewDateTop999.priority = 999;
_viewIProposeTo.hidden = YES;
}
}
@end
PaymentDetailsViewController.h
#import <UIKit/UIKit.h>
#import “BGPPlanRegisterDataModel.h”
#import “Utility.h”
@interface PaymentDetailsViewController : UIViewController<UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource>
@property (strong, nonatomic) BGPPlanRegisterDataModel *dataModelBGPPlanRegister;
@property (strong, nonatomic) UITextField *textFieldActive;
@property int intPlanSizeRs;
@property int intPlanSizeCount;
@property (strong, nonatomic) NSMutableArray *arrayTableViewData;
@property (strong, nonatomic) NSMutableArray *arrayPaymentMode;
@property (strong, nonatomic) NSMutableArray *arrayChequePickupAMPM;
@property (assign, nonatomic) BOOL isOnline;
@property (assign, nonatomic) BOOL isChequePickUp;
@property (assign, nonatomic) BOOL isChequeSendThroughCourier;
@property (assign, nonatomic) BOOL isCashPickUp;
@property (assign, nonatomic) BOOL isNEFTRTGS;
@property (assign, nonatomic) BOOL isDatePickerChequePickupChequeDate;
@property (assign, nonatomic) BOOL isDatePickerChequePickupPickupDate;
@property (assign, nonatomic) BOOL isDatePickerChequeSendThroughCourierChequeDate;
@property (assign, nonatomic) BOOL isDatePickupCashPickupPickupDate;
@property (assign, nonatomic) BOOL istableViewPaymentMode;
@property (assign, nonatomic) BOOL istableViewChequePickupAMtoPM;
@property (assign, nonatomic) BOOL istableViewCashPickupAMtoPM;
@property (weak, nonatomic) IBOutlet UIButton *buttonMinus;
@property (weak, nonatomic) IBOutlet UIButton *buttonPlus;
@property (weak, nonatomic) IBOutlet UILabel *labelPlanSize;
@property (weak, nonatomic) IBOutlet UIView *viewPANNo;
@property (weak, nonatomic) IBOutlet UITextField *textFieldPANNo;
@property (weak, nonatomic) IBOutlet UIView *viewPaymentMode;
@property (weak, nonatomic) IBOutlet UIView *viewChequePickup;
@property (weak, nonatomic) IBOutlet UIView *viewChequeSendThroughCourier;
@property (weak, nonatomic) IBOutlet UIView *viewCashPickup;
@property (weak, nonatomic) IBOutlet UIView *viewNEFTRTGS;
@property (weak, nonatomic) IBOutlet UITextField *textFieldChequePickupChequeNo;
@property (weak, nonatomic) IBOutlet UITextField *textFieldChequePickupChequeDate;
@property (weak, nonatomic) IBOutlet UITextField *textFieldChequePickupBankName;
@property (weak, nonatomic) IBOutlet UITextField *textFieldChequePickupAddress;
@property (weak, nonatomic) IBOutlet UITextField *textFieldChequePickupContactPerson;
@property (weak, nonatomic) IBOutlet UITextField *textFieldChequePickupPickupDate;
@property (weak, nonatomic) IBOutlet UILabel *labelChequePickupAMtoPM;
@property (weak, nonatomic) IBOutlet UITextField *textFieldChequeSendChequeNo;
@property (weak, nonatomic) IBOutlet UITextField *textFieldChequeSendChequeDate;
@property (weak, nonatomic) IBOutlet UITextField *textFieldChequeSendBankName;
@property (weak, nonatomic) IBOutlet UITextField *textFieldCourierAWDNo;
@property (weak, nonatomic) IBOutlet UITextField *textFieldCourierName;
@property (weak, nonatomic) IBOutlet UITextField *textFieldCashAddress;
@property (weak, nonatomic) IBOutlet UITextField *textFieldCashContactPerson;
@property (weak, nonatomic) IBOutlet UITextField *textFieldCashPickupDate;
@property (weak, nonatomic) IBOutlet UILabel *labelCashPickupAMtoPM;
@property (weak, nonatomic) IBOutlet UITextField *textFieldNEFTRTGSTransactionID;
@property (weak, nonatomic) IBOutlet UITableView *tableViewPopUp;
@property (weak, nonatomic) IBOutlet UIView *viewPopUpBelowTable;
@property (weak, nonatomic) IBOutlet UILabel *labelPaymentMode;
@property (weak, nonatomic) IBOutlet UIView *viewMain;
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UIView *viewDatePicker;
@property (weak, nonatomic) IBOutlet UIDatePicker *datePicker;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutConstraintsViewPaymentModeTop999;
– (BGPPlanRegisterDataModel *)collectDataInPaymentDetailsViewController;
– (BOOL)shouldGoNextScreen;
– (IBAction)buttonActionMinus:(id)sender;
– (IBAction)buttonActionPlus:(id)sender;
– (IBAction)buttonActionChequePickpChequeDate:(id)sender;
– (IBAction)buttonActionChequePickupPickupDate:(id)sender;
– (IBAction)buttonActionChequePickupAMtoPM:(id)sender;
– (IBAction)buttonActionCashAMtoPM:(id)sender;
– (IBAction)buttonActionPaymentMode:(id)sender;
– (IBAction)datePickerAction:(id)sender;
– (IBAction)buttonActionChequeSendThroughCourierChequeDate:(id)sender;
– (IBAction)buttonActionCashPickupPickupDate:(id)sender;
@end
PaymentDetailsViewController.m
#import “PaymentDetailsViewController.h”
@interface PaymentDetailsViewController ()
@end
@implementation PaymentDetailsViewController
– (void)viewDidLoad {
[super viewDidLoad];
/**************************************************
**************************************************
**************************************************
// Hit Below API to fetch Payment Method
// http://shagunn.info/cherishws/mobileapi/get_payment_modes
**************************************************
**************************************************
**************************************************/
NSLog(@”%@”,[Utility descriptionForObject:_dataModelBGPPlanRegister]);
_arrayPaymentMode = [[NSMutableArray alloc]initWithObjects:@”Online”,@”Cheque Pickup”,@”Cheque send through Courier”,@”Cash Pickup”,@”NEFT/RTGS”, nil];
_arrayChequePickupAMPM = [[NSMutableArray alloc]initWithObjects:@”10am to 12pm”,@”12pm to 2pm”,@”2pm to 4pm”,@”4pm to 6pm”,@”6pm to 8pm”, nil];
_viewDatePicker.hidden = YES;
_buttonMinus.layer.cornerRadius = 4;
// _buttonMinus.clipsToBounds = YES;
_buttonMinus.layer.borderWidth = 2;
_buttonMinus.layer.borderColor = [UIColor lightGrayColor].CGColor;
_buttonPlus.layer.cornerRadius = 4;
_buttonPlus.layer.borderWidth = 2;
_buttonPlus.layer.borderColor = [UIColor lightGrayColor].CGColor;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleTapTapGestureRecognizerEvent:)];
[_viewMain addGestureRecognizer:tapGesture];
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTapGesture:)];
[_viewPopUpBelowTable addGestureRecognizer:tapGestureRecognizer];
_intPlanSizeRs = 1000;
_intPlanSizeCount = 1;
_labelPlanSize.text = [NSString stringWithFormat:@”%d”,_intPlanSizeRs*_intPlanSizeCount];
[_tableViewPopUp.layer setCornerRadius:4.0f];
[_tableViewPopUp.layer setMasksToBounds:YES];
_tableViewPopUp.separatorStyle = UITableViewCellSeparatorStyleNone;
[self showViewAtIndex:0];
_scrollView.scrollEnabled = NO;
_isOnline = YES;
_viewPANNo.hidden = YES;
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated
{
_tableViewPopUp.hidden = YES;
_viewPopUpBelowTable.hidden = YES;
}
– (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark – Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
– (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
– (BGPPlanRegisterDataModel *)collectDataInPaymentDetailsViewController
{
// initial_amount;
// initial_pay_by;
// initial_cheque_dd_no;
// initial_cheque_dd_no_date;
// initial_bank_name;
// contact_address;
// contact_name;
// pick_date;
// pick_time;
// courier_name;
// courier_tracking;
// transaction_id;
// _dataModelBGPPlanRegister = [BGPPlanRegisterDataModel new];
_dataModelBGPPlanRegister.initial_amount = _labelPlanSize.text;
_dataModelBGPPlanRegister.initial_pay_by = _labelPaymentMode.text;
if (_isOnline)
{
}
else if (_isChequePickUp)
{
_dataModelBGPPlanRegister.initial_cheque_dd_no = _textFieldChequePickupChequeNo.text;
_dataModelBGPPlanRegister.initial_cheque_dd_no_date = _textFieldChequePickupChequeDate.text;
_dataModelBGPPlanRegister.initial_bank_name = _textFieldChequePickupBankName.text;
_dataModelBGPPlanRegister.contact_address = _textFieldChequePickupAddress.text;
_dataModelBGPPlanRegister.contact_name = _textFieldChequePickupContactPerson.text;
_dataModelBGPPlanRegister.pick_date =_textFieldChequePickupPickupDate.text;
_dataModelBGPPlanRegister.pick_time = _labelChequePickupAMtoPM.text;
}
else if (_isChequeSendThroughCourier)
{
_dataModelBGPPlanRegister.initial_cheque_dd_no = _textFieldChequeSendChequeNo.text;
_dataModelBGPPlanRegister.initial_cheque_dd_no_date = _textFieldChequeSendChequeDate.text;
_dataModelBGPPlanRegister.initial_bank_name = _textFieldChequeSendBankName.text;
_dataModelBGPPlanRegister.courier_name = _textFieldCourierName.text;
_dataModelBGPPlanRegister.courier_tracking = _textFieldCourierAWDNo.text;
}
else if (_isCashPickUp)
{
_dataModelBGPPlanRegister.contact_address = _textFieldCashAddress.text;
_dataModelBGPPlanRegister.contact_name = _textFieldCashContactPerson.text;
_dataModelBGPPlanRegister.pick_date = _textFieldCashPickupDate.text;
_dataModelBGPPlanRegister.pick_time = _labelCashPickupAMtoPM.text;
}
else if (_isNEFTRTGS)
{
_dataModelBGPPlanRegister.transaction_id = _textFieldNEFTRTGSTransactionID.text;
}
return _dataModelBGPPlanRegister;
}
– (BOOL)shouldGoNextScreen
{
return [self isValidAllTextfield];
}
#pragma mark – TextField Delegate
– (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
// return NO to disallow editing.
return YES;
}
– (void)textFieldDidBeginEditing:(UITextField *)textField
{
// became first responder
_textFieldActive = textField;
_viewDatePicker.hidden = YES;
}
– (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
// return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end
return YES;
}
– (void)textFieldDidEndEditing:(UITextField *)textField
{
// may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called
[_textFieldActive resignFirstResponder];
}
– (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
// return NO to not change text
return YES;
}
– (BOOL)textFieldShouldReturn:(UITextField *)textField
{
// called when ‘return’ key pressed. return NO to ignore.
[_textFieldActive resignFirstResponder];
return YES;
}
– (BOOL)isValidAllTextfield
{
[self.view endEditing:YES];
BOOL isValidate = NO;
if (_isOnline)
{
isValidate = YES;
}
else if (_isChequePickUp)
{
if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldChequePickupChequeNo.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please enter Cheque No.”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldChequePickupChequeDate.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please select Cheque Date”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldChequePickupBankName.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please enter Bank Name”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldChequePickupAddress.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please enter Cheque Pickup Address”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldChequePickupContactPerson.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please enter Cheque Pickup contact Person Name”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldChequePickupPickupDate.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please enter Cheque Pickup Date”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_labelChequePickupAMtoPM.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please Select Cheque pickup Time”];
}
else
{
isValidate = YES;
}
}
else if (_isChequeSendThroughCourier)
{
if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldChequeSendChequeNo.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please enter Cheque No.”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldChequeSendChequeDate.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please select Cheque Date”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldChequeSendBankName.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please enter Bank Name”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldCourierAWDNo.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please enter Courier AWD No.”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldCourierName.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please enter Courier Name”];
}
else
{
isValidate = YES;
}
}
else if (_isCashPickUp)
{
if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldCashAddress.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please enter Cash Pickup Address”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldCashContactPerson.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please enter Cash Pickup contact Person Name”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldCashPickupDate.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please enter Cash Pickup Date”];
}
else if ([Utility trimString_RemoveWhiteSpaceFromString:_labelCashPickupAMtoPM.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please Select Cash pickup Time”];
}
else
{
isValidate = YES;
}
}
else if (_isNEFTRTGS)
{
if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldNEFTRTGSTransactionID.text].length == 0)
{
[Utility showAlertControllerwithMessage:@”Please Select Transection ID”];
}
else
{
isValidate = YES;
}
}
// if ([Utility trimString_RemoveWhiteSpaceFromString:_textFieldName.text].length == 0) {
// [Utility showAlertControllerwithMessage:@”Please Enter Name”];
// }
// else if (![Utility isValidEmail:_textFieldEmailID.text])
// {
// [Utility showAlertControllerwithMessage:@”Please Enter valid Email ID”];
// }
// else if (![Utility isValidPhone:[@”+91″ stringByAppendingString:_textFieldMobileNumber.text]])
// {
// [Utility showAlertControllerwithMessage:@”Please Enter valid Phone Number”];
// }
// else if (_labelDate.text.length == 0)
// {
// [Utility showAlertControllerwithMessage:@”Please Select Date”];
// }
// else
// {
// isValidate = YES;
// }
return isValidate;
}
#pragma mark –
– (void)handleTapTapGestureRecognizerEvent:(UITapGestureRecognizer *)recognizer
{
[_textFieldActive resignFirstResponder];
_viewDatePicker.hidden = YES;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@”dd/MM/yyyy”];
NSString *strDate = [dateFormatter stringFromDate:_datePicker.date];
if (_isDatePickerChequePickupChequeDate)
{
_textFieldChequePickupChequeDate.text = strDate;
}
else if (_isDatePickerChequePickupPickupDate)
{
_textFieldChequePickupPickupDate.text = strDate;
}
else if (_isDatePickerChequeSendThroughCourierChequeDate)
{
_textFieldChequeSendChequeDate.text = strDate;
}
else if (_isDatePickupCashPickupPickupDate)
{
_textFieldCashPickupDate.text = strDate;
}
}
– (IBAction)buttonActionMinus:(id)sender
{
if (_intPlanSizeCount >= 2)
{
_intPlanSizeCount –;
}
if (_intPlanSizeCount <= 18)
{
_layoutConstraintsViewPaymentModeTop999.priority = 999;
_viewPANNo.hidden = YES;
}
_intPlanSizeRs = 1000;
_labelPlanSize.text = [NSString stringWithFormat:@”%d”,_intPlanSizeRs*_intPlanSizeCount];
}
– (IBAction)buttonActionPlus:(id)sender
{
_intPlanSizeCount ++;
_intPlanSizeRs = 1000;
_labelPlanSize.text = [NSString stringWithFormat:@”%d”,_intPlanSizeRs*_intPlanSizeCount];
if (_intPlanSizeCount == 19)
{
NSLog(@”PAN No.”);
_layoutConstraintsViewPaymentModeTop999.priority = 748;
_viewPANNo.hidden = NO;
}
}
– (IBAction)buttonActionChequePickpChequeDate:(id)sender
{
_viewDatePicker.hidden = NO;
_isDatePickerChequePickupChequeDate = YES;
_isDatePickerChequePickupPickupDate = NO;
_isDatePickerChequeSendThroughCourierChequeDate = NO;
_isDatePickupCashPickupPickupDate = NO;
[_textFieldActive resignFirstResponder];
}
– (IBAction)buttonActionChequePickupPickupDate:(id)sender
{
_viewDatePicker.hidden = NO;
_isDatePickerChequePickupChequeDate = NO;
_isDatePickerChequePickupPickupDate = YES;
_isDatePickerChequeSendThroughCourierChequeDate = NO;
_isDatePickupCashPickupPickupDate = NO;
[_textFieldActive resignFirstResponder];
}
– (IBAction)buttonActionChequePickupAMtoPM:(id)sender
{
_viewPopUpBelowTable.hidden = NO;
_tableViewPopUp.hidden = NO;
// _tableViewPopUp.frame = CGRectMake(_labelReferance.frame.origin.x, _labelReferance.frame.origin.y, _labelReferance.frame.size.width – _imagaeViewDropDown.frame.size.width, (HT/15.0*(_arrayTableViewData.count)));
_arrayTableViewData = _arrayChequePickupAMPM;
_istableViewPaymentMode = NO;
_istableViewChequePickupAMtoPM = YES;
_istableViewCashPickupAMtoPM = NO;
_tableViewPopUp.frame = CGRectMake(_tableViewPopUp.frame.origin.x, _labelChequePickupAMtoPM.frame.origin.y, _tableViewPopUp.frame.size.width, (HT/15.0*(_arrayTableViewData.count)));
[_tableViewPopUp reloadData];
}
– (IBAction)buttonActionCashAMtoPM:(id)sender
{
_viewPopUpBelowTable.hidden = NO;
_tableViewPopUp.hidden = NO;
// _tableViewPopUp.frame = CGRectMake(_labelReferance.frame.origin.x, _labelReferance.frame.origin.y, _labelReferance.frame.size.width – _imagaeViewDropDown.frame.size.width, (HT/15.0*(_arrayTableViewData.count)));
_arrayTableViewData = _arrayChequePickupAMPM;
_istableViewPaymentMode = NO;
_istableViewChequePickupAMtoPM = NO;
_istableViewCashPickupAMtoPM = YES;
_tableViewPopUp.frame = CGRectMake(_tableViewPopUp.frame.origin.x, _labelCashPickupAMtoPM.frame.origin.y, _tableViewPopUp.frame.size.width, (HT/15.0*(_arrayTableViewData.count)));
[_tableViewPopUp reloadData];
}
– (IBAction)buttonActionPaymentMode:(id)sender
{
_viewPopUpBelowTable.hidden = NO;
_tableViewPopUp.hidden = NO;
// _tableViewPopUp.frame = CGRectMake(_labelReferance.frame.origin.x, _labelReferance.frame.origin.y, _labelReferance.frame.size.width – _imagaeViewDropDown.frame.size.width, (HT/15.0*(_arrayTableViewData.count)));
_arrayTableViewData = _arrayPaymentMode;
_istableViewPaymentMode = YES;
_istableViewChequePickupAMtoPM = NO;
_istableViewCashPickupAMtoPM = NO;
_tableViewPopUp.frame = CGRectMake(_tableViewPopUp.frame.origin.x, _tableViewPopUp.frame.origin.y, _tableViewPopUp.frame.size.width, (HT/15.0*(_arrayTableViewData.count)));
[_tableViewPopUp reloadData];
}
– (IBAction)datePickerAction:(id)sender
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@”dd/MM/yyyy”];
NSString *strDate = [dateFormatter stringFromDate:_datePicker.date];
// _labelDate.text = strDate;
if (_isDatePickerChequePickupChequeDate)
{
_textFieldChequePickupChequeDate.text = strDate;
}
else if (_isDatePickerChequePickupPickupDate)
{
_textFieldChequePickupPickupDate.text = strDate;
}
else if (_isDatePickerChequeSendThroughCourierChequeDate)
{
_textFieldChequeSendChequeDate.text = strDate;
}
else if (_isDatePickupCashPickupPickupDate)
{
_textFieldCashPickupDate.text = strDate;
}
/*
//MM/DD/YYYY
NSDate *selectedDate = _datePicker.date;
NSDate * today = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@”MM/dd/yyy”];
NSString *selectedDateString = [formatter stringFromDate:selectedDate];
NSString *currentDateString = [formatter stringFromDate:today];
NSComparisonResult compResult = [today compare:selectedDate];
if ((compResult != NSOrderedAscending) &&
(NO == [currentDateString isEqualToString:selectedDateString])) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@”Invalid Move Date” message:@”Please select a valid Move date” delegate:nil cancelButtonTitle:@”OK” otherButtonTitles:nil];
[alertView show];
return;
}
*/
}
– (IBAction)buttonActionChequeSendThroughCourierChequeDate:(id)sender
{
_viewDatePicker.hidden = NO;
_isDatePickerChequePickupChequeDate = NO;
_isDatePickerChequePickupPickupDate = NO;
_isDatePickerChequeSendThroughCourierChequeDate = YES;
_isDatePickupCashPickupPickupDate = NO;
[_textFieldActive resignFirstResponder];
}
– (IBAction)buttonActionCashPickupPickupDate:(id)sender
{
_viewDatePicker.hidden = NO;
_isDatePickerChequePickupChequeDate = NO;
_isDatePickerChequePickupPickupDate = NO;
_isDatePickerChequeSendThroughCourierChequeDate = NO;
_isDatePickupCashPickupPickupDate = YES;
[_textFieldActive resignFirstResponder];
}
#pragma mark – View Popup
#pragma mark – TableView Delegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [_arrayTableViewData count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@”cellTableView”];
cell.textLabel.text = [_arrayTableViewData objectAtIndex:indexPath.row];
cell.backgroundColor = [UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
//-(void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
//{
// // view.tintColor = [UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1];
//}
//
//-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
//{
// return @””;
//}
//
//
//-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
//{
// return 0.0;
//}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return HT/15.0;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
_viewPopUpBelowTable.hidden = YES;
_tableViewPopUp.hidden = YES;
if (_istableViewPaymentMode)
{
_labelPaymentMode.text = [_arrayTableViewData objectAtIndex:indexPath.row];
if (indexPath.row == 0)
{
[self showViewAtIndex:0];
_scrollView.scrollEnabled = NO;
}
else if (indexPath.row == 1)
{
[self showViewAtIndex:1];
_scrollView.scrollEnabled = YES;
}
else if (indexPath.row == 2)
{
[self showViewAtIndex:2];
_scrollView.scrollEnabled = NO;
}
else if (indexPath.row == 3)
{
[self showViewAtIndex:3];
_scrollView.scrollEnabled = NO;
}
else if (indexPath.row == 4)
{
[self showViewAtIndex:4];
_scrollView.scrollEnabled = NO;
}
}
else if (_istableViewChequePickupAMtoPM)
{
_labelChequePickupAMtoPM.text = [_arrayTableViewData objectAtIndex:indexPath.row];
}
else if (_istableViewCashPickupAMtoPM)
{
_labelCashPickupAMtoPM.text = [_arrayTableViewData objectAtIndex:indexPath.row];
}
}
-(void)handleTapGesture:(UITapGestureRecognizer *)tapGestureRecognizer
{
_viewPopUpBelowTable.hidden = YES;
_tableViewPopUp.hidden = YES;
}
– (void)showViewAtIndex:(int)viewNumber
{
NSLog(@”%d”,viewNumber);
_viewChequePickup.hidden = YES;
_viewChequeSendThroughCourier.hidden = YES;
_viewCashPickup.hidden = YES;
_viewNEFTRTGS.hidden = YES;
_isOnline = NO;
_isChequePickUp = NO;
_isChequeSendThroughCourier = NO;
_isCashPickUp = NO;
_isNEFTRTGS = NO;
switch (viewNumber) {
case 0:
_isOnline = YES;
break;
case 1:
_viewChequePickup.hidden = NO;
_isChequePickUp = YES;
break;
case 2:
_viewChequeSendThroughCourier.hidden = NO;
_isChequeSendThroughCourier = YES;
break;
case 3:
_viewCashPickup.hidden = NO;
_isCashPickUp = YES;
break;
case 4:
_viewNEFTRTGS.hidden = NO;
_isNEFTRTGS = YES;
break;
default:
break;
}
}
@end
Download Sample Project From Github