How to create an expandable and collapsable menu WITHOUT a tableviewcontroller - swift

I have a question. I am trying to create an expandable FAQ menu without using a tableviewcontroller. The reason I don't want to use a tableview is because I don't want expandable cells, rather, I want a buttonclick to reveal a label while also sliding down any other buttons on this page.
I'm using Swift in Xcode 7.3
If anyone has any suggestions/knows of a tutorial/a forum post, it would be greatly appreciated.
Thank You.

Sure,nyou could use buttons, and either change constraints on label heights or dynamically add labels. That's a lot of effort and code.
Or, you could use a table view and one of the myriad guides. Remember that table views don't have to be selectable on ever row, and they don't have to display row separator lines (UI).
Indeed you could disable selection on all rows and add buttons to some rows, though I'd personally say that's overkill and why require the user to be 100% accurate with the tap on a button which in your sample image doesn't even look like a button.

Related

iOS white background behind settings controls

Is there a control that can achieve the appearance that is in this image?
It looks like some special single round cornered table cell a UISlider embedded in it.
What I am wondering is it really a table cell, it seems overkill to do this. Is it possible there is something in iOS to achieve this without using an UIimage as a background.
Thanks,
-Code
Looks like a grouped table view section with one view in it. That custom table view cell in the grouped table view section looks to have a UISlider with a UILabel on either side of it.
As a general rule, you should always lean toward using the standard built in controls unless you really need a custom look.
See the third image here: http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/tableview_iphone/AboutTableViewsiPhone/AboutTableViewsiPhone.html
Also:
http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/tableview_iphone/TableViewStyles/TableViewCharacteristics.html
From that link:
Grouped Table Views
A grouped table view also displays a list of
information, but it groups related rows in visually distinct sections.
As shown in Figure 1-4, each section has rounded corners and by
default appears against a bluish-gray background. Each section may
have text or an image for its header or footer to provide some context
or summary for the section. A grouped table works especially well for
displaying the most detailed information in a data hierarchy. It
allows you to separate details into conceptual groups and provide
contextual information to help users understand it quickly.

how to add a disclosure panel to a cellTable column in GWT

I have a cellTable with 5-6 columns. I want to put a plus icon in each row on clicking of which will display the details maybe in a disclosure panel. I have been looking around for a while now and I cannot find any information on how to achieve this. Could someone point me in the right direction?
i suspect i probably have to add a cellTree to the column? how do i go about this?
Thank you for your response in advance.
There is work in progress to allow expandable rows in CellTable among other features (maybe GWT 2.3). You can see more details here:
http://groups.google.com/group/google-web-toolkit-contributors/browse_thread/thread/b4a8a6e3c98ac061#
If that is not enough or you can not wait untill it is released I can think of two ways to achieve it:
As you said, using a CellTree.
Creating a custom cell that stores
state (open/close). Depending on the
state the cell will render
differently. In same way it is
similar to how EditTextCell works, in
"edit" state it renders an input
field while in "normal" state it renders
simple text.
I'm trying to do that too ... I managed to mimic that functionality toying with the html and a custom cell class that allows clickable pictures.
It is working for normal content such as text but if you'd like to get an asynchronous data to show in the expended line, I don't know how to do it ... (I'm trying to do exactly that).
Also, it doesn't look good because the columns don't align well ...
So what I've done is:
- create a custom cell class to display a picture (right pointing triangle, looking like the triangle in the disclosure panel)
In the click event get the HTML code of the selected row and copy it. Replace the content of the row (all cells) in the table with only one cell with its colspan set to number of columns. In the cell, add a table with first line the copied row and second line the content to display as expanded.
Get the image to sink an event for closing. In event, reset the original row that we copied.
I hope it helps.

Best approach to create a "settings" dialog page in iPhone [duplicate]

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.

Reordering Cell Icon Customized

I have a table view in which i am reordering my cells
Now the issue is that the client doesn't like the icon of the reorder (i.e. 3 horizontal lines)
Is there any way you can help out.
First of all I want to know Is it possible at all?
You cannot change the standard icon. But you should be able to use a custom button and start/end editing mode programmatically (haven't tested this).
If it isn't a very custom UI at all, tell him that messing with standard icons/behavior is the best way to make users frustrated.

How do I create a rounded table with controls in the cells?

I'm exploring the iPhone SDK and want to create and use a UI component like the figure below. A rounded table with cells in which each cell can have some label text, maybe an input text field and an action button that would take it to the next screen. The table should not be screen filling.
But... I can't figure out how to do it or find example code. The 'Table View' always seems to result in a screen filling table and although the 'Table View Cell' looks like what I need I can't find any good examples. I'm sure it's all not that hard, but I just can't find it. Any tips, pointers are appreciated.
(This figure is just an example of the sort of UI component I'm looking for, I'm not build something related to flight tracking...)
Table like component http://gerodt.homeip.net/table_ui_component.png
Gero
Try looking at the "5_CustomTableViewCell" project of the TableViewSuite code sample from Apple. It should how to create custom subclasses of UITableViewCell.
The short answer is, as alluded to above, you'll want to subclass UITableViewCell and add your custom UI elements to it. For the example you provided, you'd want two different types of cells; one with a label (in light blue) and content (in black) for 4 of your cells, and then a more complex one with additional text on the right.
You want a Grouped style table, which has sections with rounded elements as you lay out instead of filling the screen.
You also want custom table cells, which you can search here to find example code for.
As mentioned by other answers, what you want is a grouped TableView with custom UITableViewCells. Take a look at the Table View Programming Guide, in particular this section on table view creation and this section on custom cells.