0

I've looked at other UITableView questions, but did not find any that matches this scenario.

I have a normal UITableViewController that accepts an array from a search form (IOW, dynamic data). The form has a push segue to the table VC, and the table cells have another push segue to a 'details' type of screen for each item. In the table view, I call reloadData in viewDidAppear.

The first time I test the search, the table displays the "no results" view (in a screen-wide cell) that I programmed into it, but only for about 1 second. After that, the search results appear as expected and the navigation works fine.

How can I get rid of this initial glitch?

EDIT: (@Paulw11's request) The search operation is network-based, and I call performSegueWithIdentifier in the dispatch_get_main_queue block. The data is passed in prepareForSegue as an NSArray (with multiple items per index).

2
  • 1
    You need to distinguish between the case where there are no search results (indicated by, say, an empty array) and the case where the search is not yet complete (say a nil optional array) and return 0 for number of rows in the latter case. You should edit your question to show your code in order to get a better answer Commented May 30, 2018 at 20:58
  • If the search involves a network operation then I would suggest some sort of user feedback, such as activity indicator view, while that network operation is taking place. Commented May 30, 2018 at 21:01

1 Answer 1

0

This was actually an issue with the segue from the search controller to the table firing twice.

In my case, this was caused by the segue being wired to the search button instead of to the search view controller itself.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.