Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

cnstoll

macrumors 6502
Original poster
Aug 29, 2010
254
0
An app i'm working on uses a UITableViewController in a few places to display a list of data. The elements are objects that a user adds and the default state of the table is blank. Each element that is added becomes an option for a NavigationController.

Currently in the default state with a blank table it's not immediately obvious to my test users that they should add an element. The method of data entry is a "+" button on the top right, but I think a brief instruction in the main window would help a lot.

So what I'd like to do is display a short explanation of the purpose of that section to the user. Basically "Please click the + icon to add an entry". I'd like that text to only display when the table has zero elements.


What I was thinking about trying was maybe something in the viewController's viewDidLoad or viewWillAppear method that checks if the data source has zero elements, and then replace the tableView object with some sort of textView or UIView with just some basic text. Maybe that's the right way of doing it, but I'm really not sure.

If someone could just point me in the right direction here, I'm sure I can figure out the implementation details myself, if there is a good way of doing this.
 

cnstoll

macrumors 6502
Original poster
Aug 29, 2010
254
0
I experimented with the AlertView at first, but it wasn't really happy with the results. I've seen a few apps that do what I'm talking about. I guess I could do it as a conditional background image of some sort for the TableView. I haven't looked into that yet either. Right now I'm still in the "brainstorming" phase for this feature.
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
I experimented with the AlertView at first, but it wasn't really happy with the results. I've seen a few apps that do what I'm talking about. I guess I could do it as a conditional background image of some sort for the TableView. I haven't looked into that yet either. Right now I'm still in the "brainstorming" phase for this feature.
A UITableView is just a subclass of UIView and you are free to add any subviews you want to it. That is, don't worry about manipulating the table itself.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
I kind of hate alerts. They mostly just get in the way and people often hit the ok button without reading them. An expert user of your app will hate having to do that every time.

Few suggestions:

Forget about this problem. Your users will figure out that they have to hit the + button and once they figure it out they will never forget it. If your app looks like Contacts.app I think they'll figure it out.

Add a row to your table that displays in grey text the message you want to convey "Touch the add button to, um, add stuff" The row with the grey text doesn't do anything when tapped and is only shown when the table has no other content.

You could change + to "Add" or something else more descriptive.
 

cnstoll

macrumors 6502
Original poster
Aug 29, 2010
254
0
I'm think i'm going to either go with your second option, or have the tableview display a subview with instructions when there's nothing in the table. I'll just see which one works better. But yeah, it will definitely be something that once there's data it will never get seen again.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.