How to draw or put a text on empty an UITableViewController?
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 开发者_如何学Cnever 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
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.
I wouldn't direct the user to "press" anything, ever, on iOS. Use "tap" instead.
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.
If you still want to add your prompt, I would subclass a
UIViewController
, implement theUITableViewDelegate
andUITableViewDataSource
protocols, and add a the prompt (which itself will be a subclass ofUIView
) to the view hierarchy of the controller.
精彩评论