Rameez Hussain
Rameez Hussain

Reputation: 6764

Bringing subview in front of keyboard

I have a page in which I am sending a message. I have a UIView, with an UIActivityIndicatorView, which appears at the center of the screen when I click "send" and then disappears on delivery. This view is being hidden by the keyboard. I want to know how to bring it in front of the keyboard because [UIView bringSubviewtoFront] doesn't work. Any ideas?

Upvotes: 1

Views: 1556

Answers (2)

Mohit
Mohit

Reputation: 3416

This code Worked for me try it. hope it will helps you

UIWindow *window = [UIApplication sharedApplication].windows.lastObject;
[window addSubview:self.view];                                                                                                                                                                                                                                        
[window bringSubviewToFront:self.view];

Upvotes: 2

koray
koray

Reputation: 242

If this view needs to block some portion of your keyboard then I'm assuming at that point you don't need the keyboard. If you don't need the keyboard you should dismiss it using [someTextView resignFirstResponder];

pro-tip - in IOS, when you gotta bend over backwards to do something, you are probably doing it the wrong way.

Upvotes: 3

Related Questions