0

I am building a tableview with search bar on the navigation, additionally the user needs to be shown more filter options narrow down his search results.

Trying to figure out how to implement a search on uitableview with a second screen with more filter options for the user.

So far: I have created a uitableview and used a UISearchBar to get the basic search in place, have added a 'filter' button the navigation bar, the button opens up a uiview that shows the filter options to the user.

My questions are:

1/ How do I transfer the selected options back to the main uitableview so that a search can be done using the additional search filters.

2/ I have seen a few queries on SO on discussions around the 2 screen approach for advanced filter search, it would be great if someone could share an example or tutorial link of how it can be implemented in objective c.

Any pointers on how the implementation can be done will be greatly appreciated.

Have added images,

screen 1: screen2:

screen 1: https://i.stack.imgur.com/2W7cS.jpg screen 2: https://i.stack.imgur.com/rqzt1.jpg

screen 1, main uitableview with search bar and 'filters' button screen 2, advanced filters view that opens as a modal, 'Apply Filters' button should take the user back to screen 1 and show the filtered results.

screen 1 and 2 and connected by segue.

Jillian
  • 129
  • 1
  • 9
  • 1
    If your concern is how to transfer the data from view controller 2 (Filter screen) to viewController 1 (UITableView) here is a detailed answer of mine with the working code :) http://stackoverflow.com/questions/36786242/issue-with-calling-viewwillappear-of-presenting-view-controller-when-presented-o/36786919#36786919 I have explained how to use protocol and delegates to transfer data between 2 VC's as well as the concept of Unwind segue :) Read it :) If have doubt ask me :) – Sandeep Bhandari Apr 22 '16 at 21:42
  • Hi Sandeep, Thanks a lot for sharing your post, I was able to follow the unwind segue method, method 2 suggested by you and was able to communicate and fetch data between the views. – Jillian Apr 23 '16 at 10:13
  • Glad I could help you :) Happy coding :) – Sandeep Bhandari Apr 23 '16 at 13:55

1 Answers1

0

Big thanks to Sandeep for sharing the options, Sandeep's 2nd method of using unwind segue was very useful in solving the issue of communication between 2 views and passing data from the 2nd view back to my main view for search result filters.

The following simple tutorial by Natasha was also very helpful in explaining the concept of unwind segue:

https://www.natashatherobot.com/ios-pass-data-unwind-segue/

I hope this helps someone looking for a solution for a similar scenario.

Jillian
  • 129
  • 1
  • 9