Domanda

When setting a SearchBarDisplay, using IB or programmatically it gets a Cancel button right to the search window. The text on the button says "Cancel". How do I change text to another language. I know how to change text for a Done button at the Navbar using only SearchWindow but that does not seem to work for this button which comes as default.

And a similar question is the text "No result" coming up in the table if no match. How change to another language?

È stato utile?

Soluzione

You can change title of you cancel but of searchBar by this :

for (UIButton *v in srchBar.subviews) 
{
    NSLog(@"%@",v);

    if ([v isKindOfClass:[UIButton class]])
    {
        [v setTitle:@"Hello" forState:UIControlStateNormal];
    }
}

now set this title as per your language.

i tried this and its working in my demo app.

let me know if it wont work for you.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top