When long-pressing text in a uitextfield and uisearchbar the magnifier pops up that allows you to see the content of those fields more clearly, and edit them. However, I have uitextfield and uisearchbar in a scroll view, and then the magnifier is unable to show anything in that scroll view, including text entered. As far as I know I have no control over the magnifier. Any ideas?
Asked
Active
Viewed 298 times
0
-
In the thread https://stackoverflow.com/questions/36692542/magnifying-glass-shows-uiwindow-behind the windowlevel is a factor. If I do self.view.window.windowLevel += 0.1; indeed the magnifying glass shows ok. Would it be an iOS 11 bug that the window level is not correct? – RickJansen Oct 18 '17 at 11:59
1 Answers
0
I have sort of "solved" this problem by adding:
For UISearchBar:
- (void)textFieldDidBeginEditing:(UITextField *)textField {
self.view.window.windowLevel += 0.0001;
}
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
self.view.window.windowLevel += 0.0001;
}
For UITextField:
- (void)textFieldDidBeginEditing:(UITextField *)textField {
self.view.window.windowLevel += 0.0001;
}
I have tried to add self.view.window.windowLevel += 0.0001;
to viewDidLoad, viewWillAppear and viewDidAppear, too, but to no avail. I'm happy above works, but I'd like to understand it better too.

RickJansen
- 1,615
- 18
- 24