Display search results in full screen with a custom control - ios

I need to display search results for my custom control and I'm not so sure what is the best way to make this configurable.
Basically the control is similar to the UITextField but with more visualization. When the user enters some text to the field, the control would enter full screen so that the search field is on top and the results are displayed beneath. This would be very similar way to address search in Apple's Mail.app (see the attached picture).
The issue here is what would the "full screen" mean on an iPhone. If the view is presented from a table view cell, the parent view's frame is not good. The window's bounds do not work as I want to keep the navigation bar visible if there is one. Also, the full screen would be different with the iPad. With the iPad, I think I could use the pop over.
I was thinking if the controller using my custom control would provide the bounds (a delegate method perhaps?) but that feels somewhat cumbersome.
Any ideas would be appreciated.
Update:
So far I've come to a conclusion that the iPad and iPhone versions of this have to have their own specializations of the results display. On an iPad, the popover is quite trivial to implement. On an iPhone, I really can't figure out the proper way to determine the bounds for the expanded control (the text field and results table).
It is hard to describe the problem, but all I'd really need is means to expand the control to occupy some bounds (in most cases the space between the keyboard and navigation bar).

Related

Using just the textview from SlackTextViewController

I am writing a job management app that allows users to post responses to a job and I'd like to use a textview similar to the iMessage style. Essentially a textbox at the bottom of the view that when focused moves up to sit on top of the keybaord and moves the view content up aswell, but also grows as the text is being typed in.
I have come across SlackTextViewController which exactly suits my needs, however there is one issue. I already have the job view setup (Storyboard and Objective c) and all I'd like to do is use the textview portion of SlackTextViewController to write responses in, however SlackTextViewController ships with it's own tableview built in etc so whenever I use the textview, the table lays over the top of everything else on the view.
Is there anyway to 'break off' just the textview portion and use that in a pre-existing UIViewController? Or does anybody know of any alternatives that would achieve what I'm after?

How to create UIView like IMDB app

I'm trying to recreate a view.
I've seen in the IMDB app and have no idea how to do the same thing.
I'm fairly new at app building, so any advice would help.
In the IMDB app when you select pics of an actor, you get a grid view of photos.
If you tap one, it goes full screen.
If you tap full screen pic, 2 semi-transparent bars appear at top and bottom overlapping photo.
These bars contain buttons and text.
How would I recreate this in my own app? Is it a special view? Modal views I know appear from bottom and fill whole screen.
Can anyone help me?
This question is far too vague, you need to attempt this and post more specific questions as you run into problems, but here's some high-level insight to get you started: (Mind you, I haven't seen the IMDB app)
A grid view of photos could be done with a UITableView or a UICollectionView (either in a full size view controller, or placed into a UIPopoverController for iPad), and when someone taps on one you could launch a new view controller that consists of simply a UIImageView filling the screen (you could do this as a full-screen modal). In any case, this view will need to have 2 views (with backgrounds set to alpha < 1.0) which will contain your buttons and text. You will set those views to hidden until the user taps on the full screen image (which you can use a UITapGestureRecognizer for).
Take a whack at it yourself, and when you run into specific issues, post them here and the fine knowledgable people here at SO will be glad to help you.
You can show a modal view without having them come up from the bottom. pushViewController:animated:(if you're using a UINavigationController),presentModalViewController:animated:,presentViewController: animated:completion: all have a BOOL option to turn animated on or off. They probably just turned the animation off.

How to use the UIPickerView on the iPad?

Using the UIPickerView on the iPhone is quite simple as it has the right size on the screen, however on the iPad it looks rather strange. I'm wondering how to display it in the best/most user-friendly way possible?
The purpose of the view is to display and edit meta data for an item. I won't need the full screen for it. The picker is used to determine the language the text is written in and is populated from a plist.
As I see it, there are four possibilities:
A full-screen view loaded by the parent view with the UIPickerView directly in it (looks weird)
A modal view which is slightly smaller to put over the parent view and a button to load the UIPickerView separately.
A UIPopoverController which has the same size as the UIPickerView, this will however cause problems with the amount of fields I need on the screen.
Same as 3 but with a button, as in the Calendar.app, which would save some space.
Did I miss something? What would you suggest?
What about a popover controller with your fields, wrapped into UINavigationController, and one of those fields navigates to another screen with just the UIPickerView? Kind of like the alarms are edited on the iPhone.
Also maybe UIPickerView is not the right tool to choose a language. What about just navigating to a list of languages with checkmark selection, not to a screen with a picker?

UISearchDisplayController inside popover - bad animation on cancelling search

My iPad app uses a popover to perform some searching. The search results are handled using a UISearchDisplayController, and I am having some trouble removing some little graphical artefacts.
My popover starts out looking like this:
When you click inside the search bar, the popover expands (animated) to:
All good so far... typing in the search field overlays a new table view showing the results of your search term.
But if you don't type anything into the search field, the overlay stays translucent, as above. The problem then comes when you click the cancel button next to the search field. A visual artefact appears at the bottom of the table view: an area the same height as one of the table view cells goes completely clear immediately, while the rest of the overlay animates to 0 alpha. The screenshot below is as close to the start of the animation I could get:
The popover also resizes to the original size in my case, although the artefact remains even if there is no resizing.
Given that all the important functionality of the search is handled by the UISearchDisplayController, I'm not sure what to change to solve this problem. Any ideas?
This might be a bug worth reporting. There are actually a surprising number of bugs in UIPopoverController. At least 3 that I know about separate from this, none of which are planned to be fixed anytime soon (I asked several engineers at WWDC this year). One of my bugs was actually related to the UISearchDisplayController in a popover, specifically how it handles filter buttons if the Popover is in the detail view (it renders them in the worst possible way, on the same line as the text view and completely unusable).

searchResultsTableView takes entire screen on ipad

I am working on a app for the iPad which has a tableView on the left and a view on the right. We are not using the UISplitViewController.
I have been able to setup filtered results using the Search Display Controller and a search bar, but the search results take up the entire screen.
Ideally, I would like to have the search results only take up the same amount of screen as our tableView. Or, barring that, have a way to dismiss the search results when 'didSelectRowAtIndexPath' is activated.
I'm not sure what code I should post. I'm using the code from the Apple code sample: TableSearch.
on the comment below: something like this..?
[self.searchDisplayController.searchResultsTableView setFrame:myTableView.view];
By default, table views take up the whole screen, but there is nothing stopping you from setting their frame.
Just call -setFrame on the searchResultsTableView property of your search display controller.

Resources