Setting height of iOS table search bar when it includes a scope bar

In this Feedback case (only visible to prerelease testers), Greg helpfully provided declares that can be used to add a scope bar to the iOS table search options.

When I use this declare to add a scope bar, the initial state of the view shows a smaller version of the search field and no scope bar:

Pulling down or tapping into the search field shows it properly:

I suspect that this is happening because the view hasn’t been given the correct height for the search controls.

Does anyone know how I can fix this initial display problem?

Maybe related to the large Title? @Greg_O_Lone

Just out of curiosity, in which event are you calling the declares?

I don’t know if it is possible to force the scope bar to be displayed at all times. But it might not be a good idea.

Taken from a stackoverflow post:

The real question you have to ask yourself is why do I want the scope bar to always be visible? The way it works now, the scope bar will animate visible when the user taps into the search field and hide itself when the search field no longer has the focus. What’s the point of showing a search option when search isn’t even active?

I didn’t think of that scenario. Perhaps the right question is: what’s the definition of “fix” here?

For forum readers who do not have prerelease credentials, the example project Tom is referring to is available in
Xojo 2020 Release 2.1/Example Projects/iOS/Declares/iOSMobileTable Search Filters.xojo_binary_project


Thanks for the replies, gents.

Just out of curiosity, in which event are you calling the declares?

I’m using this declare after instantiating the view but before calling MobileScreen.PushTo() to show it.

I don’t know if it is possible to force the scope bar to be displayed at all times. But it might not be a good idea.

A fair point in most cases, but in my use case I want to have the scope bar shown immediately because “search is active by default”, to answer that quote: the app defaults to showing a more helpful subset of records when a list view is shown (rather than the full database) and I think that the scope bar clearly shows that’s what happening and how to change it.

I’m in the same boat in that I want the search box and scope bar to remain visible at all times, except I use @Antonio_Rinaldi’s table control and he has had the same problem implementing this.

I’ve to do some new test, but maybe I have an idea to solve this (it works with quick tests)

1 Like

Awesome, that sounds promising. Thank you for trying!

Hey @Antonio_Rinaldi, did you have any luck with your experiments into setting the initial height of the search field and scope bar?

More or less
In my test it works, now I’m embedding it in my new Table control

Thanks, Antonio! I’ll send you a DM.

Hey everyone, I’m resurrecting this topic because I still haven’t worked out how to make the “iOSMobileTable Search Filters” example project display the search controls nicely without user interaction.

Currently, it launches with the search control partially shown and the scope bar not visible. For my use case, I would like to have to have the scope bar visible because my app defaults its list views to a subset of records.

Does anyone have any idea how to achieve this?

I will look into it when I get to the office :slightly_smiling_face:

After trying a few declares and searching stack overflow I have only found this workaround:

Thanks for looking into this, Jeremie! The separate UISegmentedControl approach sounds similar to what I used with the previous Xojo iOS API, but I’d hoped that Xojo providing that “iOSMobileTable Search Filters” meant that this would be an officially supported way of adding a scope control to the handy new iOSMobileTable.AllowSearch option.

Are there any ways of setting the height of the iOSMobileTable search controller?

Can you give an example of where you’ve seen this done? We might be able to work backwards.

Thanks for the reply, Greg! It’s hard to know without know what the underlying controls are in apps: my previous version built with the old Xojo iOS API looked similar but used the UISearchBar control from iOSKit.

My preferred option would be to have the scope bar visible so that the user can see which filter has been applied, but a fallback option would be for the search controls to be entirely hidden when the view is shown: that would probably be better than the intermediate state we see at the moment, which looks like a bug.

My recollection is that enabling search doesn’t necessarily show the search field by default and that you have to drag downward to make it appear. Is that not what you are seeing?