Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toast View Hide behind Keyboard #42

Closed
mital87 opened this issue Sep 15, 2014 · 2 comments
Closed

Toast View Hide behind Keyboard #42

mital87 opened this issue Sep 15, 2014 · 2 comments

Comments

@mital87
Copy link

mital87 commented Sep 15, 2014

Hello All,
if i was validate my text field, any error are generate then i am display it on ToastView. as well as i was focus on that text field as well. so i am write down following code :

[textfield becomeFirstResponder];
[[[UIApplication sharedApplication] keyWindow] makeToast:InvalidPassword duration:3.0 position:@"bottom"];

but my toast view hide behind the keyboard. so how can i solve it. I am using Storyboard.

toast

@scalessec
Copy link
Owner

Lots of options. Add it to the top:

[[[UIApplication sharedApplication] keyWindow] makeToast:InvalidPassword duration:3.0 position:@"top"];

Or specify an arbitrary point above the keyboard:

UIWindow *window = [[UIApplication sharedApplication] keyWindow];
[window makeToast:InvalidPassword duration:3.0 position:[NSValue valueWithCGPoint:CGPointMake(window.frame.size.width / 2.0, 80.0)]];

Or instead of presenting the toast in the window (anything added directly to the window is generally considered bad practice because it breaks the concept of a view hierarchy. It also won't work properly if your app supports rotation because the toast won't be a subview of your root view controller's view).

[self.someContainerViewPositionedAboveTheKeyboard makeToast:InvalidPassword duration:3.0 position:@"center"];

@mital87
Copy link
Author

mital87 commented Sep 16, 2014

Thanks buddy for your support. Any other option to show toast on bottom without hiding view behind the keyboard?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants