I have write a function thats displays the toast on UIVIewController
. The toast function is given below
-(void)showToast:(NSString*)string
{
MBProgressHUD *hud;
hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.mode = MBProgressHUDModeText;
hud.labelText = string;
hud.margin = 10.f;
hud.yOffset = 150.f;
hud.removeFromSuperViewOnHide = YES;
hud.userInteractionEnabled = NO;
[hud hide:YES afterDelay:2];
}
Now the issue is that my toast message hides behind the keyboard. Can anyone tell me how to show toast above the height of keyboard?
Similar question with answer is here: Position MBProgressHUD at the Bottom/Top of the screen
In short, use the yOffset
property of the MBProgressHUD
to change its Y position.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With