I know this question has been answered before, the answer below looks pretty good.
https://stackoverflow.com/a/4124023/1098059
However, most of the answers date from before iOS 5. With the new static tables in iOS 5 what is the best way to insert text fields?
If the table has static content (number of rows and sections is constant) the easiest way is to add labels, text fields etc. right inside your storyboard or xib.
Related
I've read this post : How to customize the background/border colors of a grouped table view cell?
And I want to display a background cell. So I'm trying a use the previous post in the tableView function willDisplayCell.
No matter what I do, nothing is working. Could you help me out ? (My cells are 50pt high.)
Thanks
That question was posted two and a half years ago? for OS2 and then OS3. Probably not valid for OS4 or OS5.
An Apple engineer told me not to override drawrect like this as it was a "hack" and would likely break in a future OS version. So I would avoid doing that.
I don't know if I'm completely missing the boat here or what, but I can't figure out how to achieve conjoined email/password text fields like on the flow login screen. Any help is appreciated!
FYI: I'm using XCode 3.2.5
It's a custom table view cell with a label and a text field in a grouped table view probably with a single section and two rows one of which is for username and other for password. The logo could be the table view's header.
There is a simpler solution that requires no code.
If you have Photoshop, all you need to do is:
Make a new file (I recommend using the size of iPhone/iPad so you get the right size of the box you will make)
Use the Rounded Rectangle tool to make your box
Use the Line Tool to divide it up into the rows you want
Then just add it to your app as an image
Use text inputs with no borders, size them, and wa-la!
Super easy even for those not familiar with Photoshop.
Using XCode, Interface Builder, and Storyboards and Static Content.
UITableViews with static content are a new feature in Xcode 4.2 that allow tables to be designed WYSIWYG. Cells can be dragged into the table and customized by changing properties and adding controls. In previous versions of Xcode each cell would be a separate XIB file.
I am very new to iphone application development and am struggling to create a table view page where each row contains a left-aligned label with an editable text next to it - just like how it works in the email account details page in the settings application on my iphone.
I have been googling the subject for hours and it is now somehow clear to me that I need to add UITextFields to UITableViewCells, but it is still not at all clear to me how I make these text fields take up the right amount of space:
How do I make the text fields align above each other?
How do I make the text fields expand as far as possible to the right?
How do I prevent the text fields from hiding part of the left-aligned label?
Read the Apple Docs on Tableviews there are a number of predefined table cells. Also look at the Tableview programming Guide. Pick the one that has the font characteristics that you want and Apple will take care of it for you. Also, in the Settings app, the settings are a Grouped style.
For the look you are describing I think it is called UITableViewCellStyleSubtitle.
You need custom UITableViewCells and there are a number of ways of making them. For your purposes, any one of the techniques detailed in the Apple documentation will probably suffice.
An alternative to those approaches is in GSUtils (full disclosure: open-source library written by me), where you can use the same approach to designing your table view cells as you would design a UIView.
This question already has answers here:
How to create a UITableView with editable components?
(2 answers)
Closed 3 years ago.
I need to present the user with a screen with controls (i.e. a dialog). It will display some labels and different types of controls so that the user can do some configuration:
select a color (custom color picker)
select a line width (slider)
select one value from a list of values (UISegmentedControl?)
enable / disable one option (On/Off)
...
I am evaluating different alternatives:
Create the layout with labels and controls in InterfaceBuilder
Use a UITableView, so that each cell contains a label and its control
I like option 2 because it is similar to iPhone Settings app, and it makes the screen look organized, giving you sections, scroll..., but it is a real pain to create in code all different cell layouts, taking into account each row heights...
The solution has to be easiliy maintainable, allowing easy reuse of code, DRY (low repetition), data-driven...
Is there a recommended or standard aproach to do this?
Instead of implementing it yourself you might also like to consider some of the open source solutions. I use InAppSettingsKit in my app. There are a few minor UI glitches but it works well. I also evaluated mySettings (indeed I submitted a couple of patches) and InAppSettings.
Even if you don't use them, you might be able to crib a few ideas from them.
You can create the tableview cells in IB and then just create IBOutlets to each cell, and then return each cell in the data source method (forgotten the exact name of it, its where you normally create cells)
You could create a cell in IB for each cell or create different types of cells in IB, say one slider based cell, etc and programmatically change the text, etc.
This is staticly creating a tableview, theres an Apple guide on it somewhere.
you said it. use a UITableView and create custom UITableViewCells (probably in Interface Builder!) and add these in.
Also, as far as selecting a value from a list of values.. a drill in UITableView (embed the root UITableView in a navigation controller) with all the options and then a checkmark is probably advisable (this is how most apps handle this behavior). The On/Off button is more suited for UISegmentedControl.
There are great examples of this in this book.
Good luck.
I've not found a answer to this question anywhere, but this seems like a typical problem: I am dynamically (from a xml file) creating a view to display "Questions" I take from the XML file. I am having problems to display multiple choice questions. I am trying following approach:
Question 1
MultipleChoiceQuestion 2
--First Option
--Second Option
--Third Option
Question 3
Question 4
MultipleChoiceQuestion 5
--First Option
--Second Option
and so on...
So, my Idea is: I have a first UITableView and row for each "normal" question , and a second UITableView for each "Multiple Choice" question that should be loaded into a row from the first UITableView as I showed before.
Is this a good approach or you guys have a better design pattern for this issue?
Thanks a lot!
There is a tutorial for creating custom UITableViewCells with UITableView inside it at:
http://iosstuff.wordpress.com/2011/06/29/adding-a-uitableview-inside-a-uitableviewcell/
iOS SDK is flexible and you can add any UIView subclass element to tableview cells. Have a look at 'Pulse', its a news reader app that won Apple Design Award. This app has horizontally scrollable images and its developers explained that how they used UITableViews to create that. So don't be afraid to implement new ideas no matter how wild they might appear.
Good Luck!
No, no! Please, no! Do not place big UI Elements like table views in a tableviewcell (and surely do not make them scrollable =P).
What about making the user be able to select a question (one question per row) and then show up a picker view with answers, on the place where to keyboard would normally be?
Just like a list of HTML select tags in Mobile Safari.
Or you can use a grouped table view with one group per question, including the chosable answers.