views:

37

answers:

2

Hi

I have a app that starts with a empty UITableViewController, which is pretty .. well, emtpy. Now I was wondering if I could hint the user by painting something else on the view, like pointing an arrow to the plus button and say something like "press here to add something new"

I'll guess I have to do this in the viewDidLoad method, where I also init my NSFetchedResultsController, so I actually know if there are any objects in my list. I never put controls on the screen by code so I am not sure where to start and where to put em on. will that be the [self view] ?

Thanks

A: 

You could either try [tableview addSubview:xyz] or add it to the UITableViewController holding viewcontroller or you could (iphonestyle) add an add button to the NavigationBar.

Allisone
A: 
  1. I wouldn't direct the user to "press" anything, ever, on iOS. Use "tap" instead.

  2. If you're using standard UI, you'll probably have a button that looks like [+], which is consistent enough across iPhone apps that your prompt should be unnecessary.

  3. If you still want to add your prompt, I would subclass a UIViewController, implement the UITableViewDelegate and UITableViewDataSource protocols, and add a the prompt (which itself will be a subclass of UIView) to the view hierarchy of the controller.

Shaggy Frog
I do have an + button, what I want is to point it out that someone can actually press this button, in case there is no data.Imagine the standard UITableViewController with a topbar that has the + button at the right corner and a graphic that points to that + button
elementsense
If you're trying to handle the situation "there is no data", you'd be better off showing an indication in your table. For example, in one of my apps, when there's no data to show, I show a table cell with the label "No data". As soon as the user adds data, that cell is no longer shown.
Shaggy Frog