Form design in IPhone - What control(s) to use? - iphone

I am interested in creating a form in an iphone application similar to this one. Mine would probably have a textbox as well but I was wondering what kind of control(s) should I use? Is this a grouped UITableView where the cells are hardcoded? If that's the case what about events on the textboxes? will they still fire on the tableview level.
Thanks a lot.

Yes, you should use a grouped UITableView. From there you need to create UITextFields and add them to your table view cells. You can either create your own cell, by subclassing UITableViewCell, or you can simply add text fields in cellForRowAtIndexPath.
Then, to receive events from the text fields you need to set the delegate and use the UITableViewDelegate methods mentioned here.
https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITextFieldDelegate_Protocol/UITextFieldDelegate/UITextFieldDelegate.html

There is an UICatalog sample code in apple develop site, you can check that out.

Related

sticky selected cell in UITableView like the new twitter ipad app?

any idea how to have the selected cell in UITableView sticky and remain visible while scrolling? like how the twitter ipad app works. i would like it on my splitview's uitableview.
You are probably using a UITableViewController right? This automatically deselects a selected row. To avoid this, the best option would be to use a normal UIViewController with the protocols UITableViewDelegate and UITableViewDataSource.
Building from a comment Vince made on my previous answer (since deleted since it was more of an explanation of how long and how much effort a feature like this would take rather than an attempt at answering the question).
You could store the index path of a cell when it becomes selected, and then as the cell is about to scroll offscreen (you'll need some trickery to detect this) you could retrieve the cell view returned from cellForRowAtIndexPath and set a section header view to use this cell view.
This would be a pretty monstrous hack though, and you'd need to find a way to elegantly split the table into sections in order to use the section header.
I wouldn't recommend this approach, although its a step in the right direction.

iPhone Recent Calls Details View - Custom Cell?

I would like to have something that would kind of replicate the details view of the recent calls tab on the iPhone phone.app.
When viewing the recent calls, tapping the disclosure button takes me to the view pictured here: http://img337.imageshack.us/img337/3456/recentcalls.jpg
I would like to know if that area in blue represents a custom cell. Am I right? Or is there an easier way to accomplish this?
My need for replicating this comes from my trouble with heightForRowAtIndexPath, as explained here: heightForRowAtIndexPath for only one section?
(I won't be using heightForRowAtIndexPath anymore with this solution).
Thanks in advance.
It looks like the area you've outlined in blue is the section header for the first section. You could also just use the table header.
Matt Gallagher posted a nice article on customizing your table header.
If I had to guess, it is likely a custom section header view, glued together from various labels and other widgets.
It would certainly seem much, much easier IMO to do this with a custom table view header view than with a custom table view cell.
See the table view delegate method -tableView:viewForHeaderInSection: where you return your custom UIView object for a given section.

UITableView and UITableCellView, how does this work with core plot?

I'm very new to iPhone programming, and I'm currently following tutos to understand the whole thing. I've been able to do what I needed (retrive data from a JSON http server, parse them with YAJL and plot the data in core plot). I have done this in a "simple" view where I have added a UILayerHostingView as requested by core-plot.
I am now trying to follow this tuto: http://blogs.remobjects.com/blogs/mh/2010/01/26/p973 but I am missing the first part regarding the views...
My understanding is that I need to create a view with a UITableView first. Then add a UITableCellView to make the first cell be able to contain the graph ? Is this right ? Where does the method "(id)initWithStyle:(UITableViewCellStyle)style" come from ?
For my needs, only the first cell needs to contain a graph, I will put some other info in the other cells.
As for now, I have created a new GraphListViewController, in the corresponding view I have added a listview but I do not see any auto generated methods regading cell customisation ? Do I need to implements DataSource in this controller and manually add some customisation methods ? Do I need to add a UITagbleViewCell to this UITableViewTable within IB ?
Hope I am not getting to confusing...
Thanks a lot for your help,
Best Regards,
Luc
To start with, create a new file ...
Cocoa Touch Class -> UIViewController subclass
and click the UITableViewController subclass checkbox. This will do all the tableview work for you. You can now open the xib file and change all the properties that you want for this.
Once this is done you need to populate the cells within the table. The first thing you need to do is to tell the controller how many cells to display. For this update the numberOfRowsInSection: method to return how many you want.
The next part is where you want to create the cell and is done mainly in the cellForRowAtIndexPath and for this I'm gonna redirect you to the following good tutorial on adding custom cells.
http://iphonedevelopment.blogspot.com/2009/09/table-view-cells-in-interface-builder.html
This explains a bit of the 'magic' that happens
Hope this helps
Liam

iphone screen - type of view to use

looking for some advice on what type of view can be used to build a screen with the following elements:
2 labels followed by 2 buttons.
Then a small table view with 3 rows.
Should a UIView be used or a UITableView?
I've attempted using a UITableView - however I couldn't add the labels or buttons.
So I've now built the view using a UIView. I added the labels and buttons and then a UITableView from the library. However I have no idea how to populate the rows in the table?
Any ideas?
Regards,
Fiona
You could always create the view that you want and return it in the table view delegate's -tableView:viewForHeaderInSection: method. That would give you your table view rows that you want plus your custom view above it.
You need to learn how to use the UITableView before going any further. Time taken now will pay off later on.
There are plenty of tutorials about the UITableView, but I found the best learning I had was from the free iTunes U Standford iPhone course. You don't need to watch it all, but at the very least you should watch the episode on UITableView, as it'll cover everything you need to know. I strongly recommend watching it all, especially the first 8 or so lectures, as it covers the basics of what you need to know really, really effectively.

iPhone app - some custom UITableViewCell questions

At the moment, I have a settings view in my iPhone app built with Interface builder, it consists of a background image, some text fields, labels and buttons. Because this looks bad, I want to convert the settings view to an UITableView with custom UITableViewCells.
I already tried adding some cells into my settings view's XIB and returning them in the cellForRowAtIndexPath method (with [return myCell];), as written in Apple's tutorial, but this was not working for me - my whole TableView looked strange and it only showed the first cell correctly.
Is it possible to design these custom cells in Interface Builder? Do I have to create an empty XIB for them or can I put them in my view's XIB? And how do I insert them into my TableView?
Thanks in advance,
Yassin
You can absolutely add custom table cells that you built in interface builder. This includes both static cells and Dynamic cells. However without you providing more information the best I can say is "double check the docs and try again." I can only say that it works and it's rather straightforward so it's hard to say what you may have missed. It might be more helpful if you post what you have for the tableView:cellForRowAtIndexPath method.
Since you say you just have some text fields, I would recommend looking at the technique for static row content section of the Table View Programming guide. You probably would want to have each field of your form correspond to a row in a Segmented Table View, it'll make everything look nicer.