I am using a UITableView to display some data which the user can filter. If a certain (perfectly "legal") combination is selected, all data is filtered out (hidden). I would like to display some text stating that no results were found and to please modify your filters.
Does anything trigger when this occurs that I can hook in to?
Or will I have to manually check for an empty data set and create a custom view to display my text? (I was thinking of creating a blank cell and using that footer? Hoping for something more elegant...)
I found a similar question, but the solution is not what I am looking for: Handling empty UITableView in UITableViewController
Also, I have an Android programming background and use this exact feature frequently, I would be surprised if Apple didn't do this as well!
Put a custom view with your error text message behind the table. Then when there is no data to be displayed set table.alpha=0.0 (or table.hidden=YES), while when you have this data available set table.alpha=1.0 (or table.hidden=NO).
You can do the control on the "OK" button (or equivalent) of the filter.
Related
So I want users to be able to enter a search query, and should it return an empty or non-empty result the appropriate view is displayed (shown below):
As I'm fairly new to iOS I thought about the following possible ways of implementing this. I'm not sure if any one of these is deemed as good practice or maybe another better solution exists:
Create two separate view controllers with their own views that will display a message for empty search results or show non-empty results respectively
Create a single view that will house all of the components and show/hide certain components based on whether or not the results are empty/non-empty
Create a single view, but programmatically implement the methods for drawing the relevant components and just initialise the VC with the respective designated initializer (one for empty and the other for non-empty results)
The best practice is to manage the empty state of tableview meaning have a single tableview and display data when available, if no data is available display a friendly message in the tableview itself.
Below is the link that will help you implement the code:
http://www.ryanwright.me/cookbook/ios/objc/uitableview/empy-table-message
There are ots of examples available on net for managing the empty state of tableview.
im new in ios development and i want create a profile page with UITableView i tried Google, but i didn't find anything :( Assuming that i have 1 field (Name) on UITableView, when i click on "Edit" Button, i want the TabViewCell to became a UITextFields to let me edit the data. And then when i click the "Done" Button the UITextView became a TabViewCell again with new Value, All i can found as tutorial, is just how to delete, add or move a cell.
Does apple have an api for making editable forms in iOS?
No, there's no API specifically for creating editable forms, but UIKit certainly provides all the tools you'd need to create editable content of all kinds. Instead of relying on tutorials to show you the solution to every problem you need to learn how to use the API that's there to construct the user experience that you imagine. Until you do that, you won't be able to implement any original ideas.
Using a table is a reasonable way to create the form you want. Consider using a different type of cell when the user hits the Edit button. So, when Edit is tapped, reload the table content using the editable cell types instead of the normal ones. When they hit Done, record the changes and then reload again using the non-editable cell types.
I'm totally new to App design for iOS. I am designing an iOS app with Swift. I have a RESTFul service that returns a list of Cities based on a partial string query. My webapp uses Jquery-AutoComplete to perform the operation and it works great, I was wondering how I can achieve the same drop-down list look with Swift.
Here's how I retrieve the data. If the size of UITextField is greater than 3 characters, my App Starts sending the content of the UITextField to my RESTFul Service and get back the list of cities that start with those characters (My service returns the top 10 matches).
My challenge is, how can I show a drop-down under the UITextField just like JQuery-AutoComplete list ?
From comments above:
I would use a UITableView underneath your UITextField, which you would then populate its data source with the response from your web service.
does it integrate seamlessly ? I mean when there is no data it hides automatically or I have to track its visibility ?
You can set the hidden property of the table view depending on whether there is anything to display from the web service response. If there is no data set hidden to TRUE, if there is data set it to FALSE and use the reloadData method to reload the table views data source.
Thanks. So one last question, If I have stuff under the UITextField, when I set the visibility of UITableView, is it going to appear over the background and elements under the UITextField or it's going to push them down and rearrange the UI ?
This all depends on how you set up your UI. I would add the table view as a subview of the main view which would add it above any other objects. Again, however, this would depend on how the rest of the UI is set up. You can use the insertSubview: aboveSubview: method to make sure the table view is above all other views. Setting the hidden property of the table view to TRUE will not have any affect with regards background of objects underneath.
I'm writing a app that contains quite a bit of input fields for collecting data.
and im wondering what are some good methods to display these kind of input fields, if there are too many to fit on a screen? so something like the add contact screen... where u can scroll down and there are fields there
my initial idea is to put them in a scroll view and then i can scroll through them, is there a tutorial to do this? it seems like the scroll view is more for dynamically displaying data like a text view, and not for static forms like i was describing.
if anyone has any different methods for doing this please post.
UITableview will match perfectly for what you need.
My friend wrote this which is a container view that automatically helps with moving fields out of the way of the keyboard - It will certainly save you some time if you don't want to use a UITableView:
https://github.com/mackross/GTKeyboardHelper
The other way as H2CO3 suggested is to use a UITableView. If it is a UITableViewController, then you get the moving out of the keyboards way automatically. You could build custom table view cells that are styled to have a prompt and a UITextField for input. You can also set the selectionStyle to UITableViewCellSelectionStyleNone to prevent these cells from highlighting when selected.
I think the third way is to do this with a UINavigationController (or a UIPageControl) and build a kind of wizard, where you go through various pages of related data. This might be the neatest way depending on how many fields you have and if you can group data into common sets (e.g. personal information, work information etc)
I had the same problem and found GTKeyboardHelper to be an easy way out.
After drag and drop the framework in your project, include the header file.
Download and open the example project, then drag the "Keyboard Helper" object from the objects section in the xib to the objects section in your project's interface builder.
Drag and drop all your views to be children of the "Keyboard Helper".
Using MonoTouch.Dialog I create a table of values.
When the user clicks a row, the row should flash blue as per normal.
How do I enable this in MonoTouch.Dialog?
MonoTouch.Dialog supports the flashing behavior for Elements that can actually respond to events (like the StringElement when it has a tap-handler attached) or other elements that need to respond to the user's interaction.
This is done by setting the SelectionStyle property on the cell to UITableViewCellSelectionStyle.Blue
Most of the cells that do not respond to user's input have the value in MonoTouch.Dialog set to None. You can either change the source code to make it use Blue everywhere, or make sure that you are using the right Element for the right use case.
I blogged about some design patterns for building Elements recently, if you want to roll your own:
http://tirania.org/monomac/archive/2011/Jan-18.html