Skip to content

Commit

Permalink
got window object from current controller instead taking from AppDele…
Browse files Browse the repository at this point in the history
…gate
  • Loading branch information
umangarya336 committed Jan 28, 2020
1 parent 38fed8f commit 8ca6ecc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ -(void)initializeMonthYearPicker{

NSLog(@"Year Index%lu",(unsigned long)[arrYear indexOfObject:currentYear]);

MonthYearPickerView = [PUUIUtility showPickerViewWithDelegate:self];
MonthYearPickerView = [PUUIUtility showPickerViewWithDelegate:self onWindow:self.view.window];

// By default it should select current Month and Yaer
[MonthYearPickerView selectRow:(unsigned long)[arrMonth indexOfObject:currentMonth] inComponent:0 animated:true];
Expand Down Expand Up @@ -244,10 +244,11 @@ - (void)clickedBtnDoneToPicker:(id)sender
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
if (textField == self.txtFieldMonth || textField == self.txtFieldYear) {
if (!self.grayView) {
self.grayView = [[UIView alloc] initWithFrame:APP_DELEGATE.window.frame];
self.grayView = [[UIView alloc] initWithFrame:self.view.window.frame];

self.grayView.alpha = .5;
self.grayView.backgroundColor = [UIColor grayColor];
[APP_DELEGATE.window addSubview:self.grayView];
[self.view.window addSubview:self.grayView];
}
else{
[self.grayView setHidden:NO];
Expand Down Expand Up @@ -643,7 +644,7 @@ -(void)hidePickerView{
if (self.grayView) {
[self.grayView setHidden:TRUE];
}
[PUUIUtility hidePickerView];
[PUUIUtility hidePickerViewFromWindow:self.view.window];
}

#pragma mark - Getter method of card/CVV max length
Expand Down
1 change: 0 additions & 1 deletion PayUNonSeamlessTestApp/PayU/SDKUI/Utility/PUUIConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ typedef NS_ENUM(NSInteger, TableViewType) {
//#define CELL_IDENTIFIER_EMI_BANKNAME @"EMIBankNameCell"
//#define CELL_IDENTIFIER_EMI_DURATION @"EMIDurationCell"

#define APP_DELEGATE [[UIApplication sharedApplication] delegate]
#define IS_IPHONE4 ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 480)
#define PAYU_ALERT(T,M) dispatch_async(dispatch_get_main_queue(), ^{[[[UIAlertView alloc] initWithTitle:T message:M delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];});

Expand Down
4 changes: 2 additions & 2 deletions PayUNonSeamlessTestApp/PayU/SDKUI/Utility/PUUIUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
*/
+ (NSString*)getNameOfImageForCardBank:(NSString*) issuingBankName;

+ (UIPickerView *)showPickerViewWithDelegate:(id)delegate;
+ (void)hidePickerView;
+ (UIPickerView *)showPickerViewWithDelegate:(id)delegate onWindow:(UIView *) window;
+ (void)hidePickerViewFromWindow:(UIView *) window;
+(BOOL)isUserCredentialValid:(NSString *) userCredential;
+(NSNumber *)getCardLengthForCardIssuer:(NSString *) cardIssuer;
+(NSNumber *)getCVVLengthForCardIssuer:(NSString *) cardIssuer;
Expand Down
12 changes: 6 additions & 6 deletions PayUNonSeamlessTestApp/PayU/SDKUI/Utility/PUUIUtility.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@

@implementation PUUIUtility

+ (UIPickerView *)showPickerViewWithDelegate:(id)delegate
+ (UIPickerView *)showPickerViewWithDelegate:(id)delegate onWindow:(UIView *) window
{
UIView *viewActivity = [APP_DELEGATE.window viewWithTag:502];
UIView *viewActivity = [window viewWithTag:502];
UIPickerView *cityPickerView = nil;

if(!viewActivity) {
viewActivity = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetHeight(APP_DELEGATE.window.frame)- (162 + 44), CGRectGetWidth(APP_DELEGATE.window.frame), (162+44))];
viewActivity = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetHeight(window.frame)- (162 + 44), CGRectGetWidth(window.frame), (162+44))];
viewActivity.tag = 502;
viewActivity.backgroundColor = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.0f];
[APP_DELEGATE.window addSubview:viewActivity];
[window addSubview:viewActivity];

cityPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, CGRectGetHeight(viewActivity.frame)- 162, CGRectGetWidth(viewActivity.frame), 162)];
cityPickerView.tag = 503;
Expand Down Expand Up @@ -67,9 +67,9 @@ + (void)clickedBtnDoneToPicker:(id)sender {
*/
}

+ (void)hidePickerView
+ (void)hidePickerViewFromWindow:(UIView *) window
{
UIView *viewActivity = [APP_DELEGATE.window viewWithTag:502];
UIView *viewActivity = [window viewWithTag:502];

if(viewActivity)
[viewActivity removeFromSuperview];
Expand Down

0 comments on commit 8ca6ecc

Please sign in to comment.