switch to using a green underline on the placeholder text of the search bar rather than the full-width green separator, to make it more obviously tappable and less like a header

This commit is contained in:
Matthew Hodgson
2016-06-04 19:20:18 +01:00
parent 2fd6b5b0a7
commit d218aeee6a
@@ -1326,6 +1326,8 @@
searchBar.barTintColor = searchBar.tintColor = kVectorColorGreen;
searchBar.tintColor = kVectorColorGreen;
// FIXME: this all seems incredibly fragile and tied to gutwrenching the current UISearchBar internals.
// text color
UITextField *searchBarTextField = [searchBar valueForKey:@"_searchField"];
searchBarTextField.textColor = kVectorTextColorGray;
@@ -1341,6 +1343,7 @@
effectBackgroundTop.hidden = YES;
effectBackgroundBottom.hidden = YES;
/*
// add line separator under the textfield
if (!searchBarSeparator)
{
@@ -1386,10 +1389,13 @@
[NSLayoutConstraint activateConstraints:@[leftConstraint, widthConstraint, heightConstraint, bottomConstraint]];
}
*/
// place holder
[searchBarTextField setValue:kVectorTextColorGray forKeyPath:@"_placeholderLabel.textColor"];
searchBarTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:searchBarTextField.placeholder
attributes:@{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle),
NSUnderlineColorAttributeName: kVectorColorGreen,
NSForegroundColorAttributeName: kVectorColorGreen}];
}
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText