views:

228

answers:

2

Hi there I guess the title says it all. I use a UISearchBar for entering an address to establish a network connection. While the connection is made I want to show the activity indicator instead of the tiny BookmarkButton on the right side of the searchbar. As far as I can see there is no public declared property that would give me access to the correct subview of the searchbar. I have seen this been done, any thoughts?

A: 

where you have seen this been done?

Rahul Vyas
The app "Wikipanion"(free) does it.
Monobono
is this app native iphone app or a web app?
Rahul Vyas
+1  A: 

Just for the record:

for(UIView* view in self.subviews){
    if([view isKindOfClass:[UITextField class]]){
       searchField=view;
       break;
    }
}

if(searchField !=)) {
   searchField.leftView = myCustomView;
}

You can subclass UISearchBar and call this code in the layoutSubview method. calling this code in layoutSubview makes sure that resize animations work properly.

Monobono
Oh please use for-in loop `for(UIView* view in self.subviews){if([view isKindOfClass:[UITextField class]]){searchField=view;break;}}`.
KennyTM