Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing Toast above keyboard in Obejctive c [duplicate]

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?

like image 590
Usman Javed Avatar asked Nov 09 '22 00:11

Usman Javed


1 Answers

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.

like image 87
Vrasidas Avatar answered Nov 15 '22 13:11

Vrasidas