I have a UIView that contains your typical UITableView with a UISearchBar. It seems though the Interface Builder will not let me alter the layout as I have the need to add a button to the right of the search bar.
Is there a way to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First you need to create a hook for your UIToolbar, create a property with an
IBOutletdirective.eg:
attach it to the toolbar that holds the UISearchBar, then you access the toolbar in code when your
viewDidLoadcopy the UIToolbar.items into an array, insert your button object into the array at any index you want then assign the array back to the UIToolbar.items with this function: