search-bar color not applied correctly

This commit is contained in:
Vladimir Enchev
2015-11-02 15:00:20 +02:00
parent 11b60656eb
commit 3b65d29483

View File

@@ -106,7 +106,7 @@ class UISearchBarDelegateImpl extends NSObject implements UISearchBarDelegate {
export class SearchBar extends common.SearchBar { export class SearchBar extends common.SearchBar {
private _ios: UISearchBar; private _ios: UISearchBar;
private _delegate; private _delegate;
public _textField: UITextField; private __textField: UITextField;
constructor() { constructor() {
super(); super();
@@ -119,7 +119,6 @@ export class SearchBar extends common.SearchBar {
public onLoaded() { public onLoaded() {
super.onLoaded(); super.onLoaded();
this._ios.delegate = this._delegate; this._ios.delegate = this._delegate;
this._textField = SearchBar.findTextField(this.ios);
} }
public onUnloaded() { public onUnloaded() {
@@ -135,16 +134,11 @@ export class SearchBar extends common.SearchBar {
return this._ios; return this._ios;
} }
private static findTextField(view: UIView) { get _textField(): UITextField {
for (let i = 0, l = view.subviews.count; i < l; i++) { if (!this.__textField) {
let v: UIView = view.subviews[i]; this.__textField = this.ios.valueForKey("searchField");
if (v instanceof UITextField) {
return v;
} else if (v.subviews.count > 0) {
return SearchBar.findTextField(v);
}
} }
return undefined; return this.__textField;
} }
} }