Requirement : implementing a drowdown functionality in an UIView
The known way is using a UIWebView.
My Q is can this be done via a TableView?
Is there any way which lets me select a section(just like selecting a row), so that I can implement a hide/show cells of a section when that particular section is selected?
Don't know if I am understanding you correctly, but it seems to me that what you want can be done like this:
have a UITableView with several sections;
each section has got just one row;
when a specific row for a section is selected (didSelectRowAtIndex), you change the data source associated to that section by adding more elements and reloadData on the table.
when a specific row for a section is selected you also modify the data source corresponding to any other section so that it only contains one row.
EDIT:
From your last comment, it seems to me that what you are trying to do is a generic dropdown menu: you click somewhere and it displays; now, in your specific case you are thinking of clicking on a table, but it could in principle be anywhere else. I am saying this (if I am not wrong), because if it is so, then you can find ready-made implementations, like WEPopover, and you could save some effort.
Going back to your asking, in the case you are mentioning, you can animate the height of the table view frame (or bounds), so that its content is displayed little by little, as the view height increases; have a look at this Tutorial about Core Animations.
Related
I am trying to write a custom inline row using Eureka but I couldn't do it by following the documentation in the Github page of the library.
Also I copy-pasted this answer but it throws a segmentation error. I also tried searching for tutorials on the internet to follow but there is none.
Can someone clearly and basically explain how can I do this?
See if this is the place you want to look into
Also, are you using this library just to do a collapsible cell? You can do that by yourself and that is really not hard & a lot of code to implement. Check out this exmaple. All you need is to define child cells and parent cells in a section and reload it with animation!
I know it's a long tutorial. You can probably skip the top half, and start reading from Expanding and Collapsing section. The basic idea is, a collapsible cell and the collapsed cell are within a section, and you have a variable per section of cells to remember if the section is expanded or not. When clicked on the first cell of the section, if it's already expanded, reduce the cell count to one and do a reload to this section using animation Fade. and vice versa. This Fade animation will produce the animation you want.
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.
Background: I have implemented a standard tableView that has 4 sections. Each of the section contains a custom view for the header. Normally, the previous header will be pushed away when the header below is scrolled to the top of the tableView.
Question: Is it possible to prevent that "pushed out" behavior. I would like something along the line of "stacking" behavior. This is because I would like the user to have the full view of what headers are available. For example, if one scroll to the lowest cell, one will see all headers on the top of the tableView.
Additional Info: Please do not answer with hacks, for example, track the movement of the tableView, add the header view manually when needed, then resize the tableView.
It's not possible without using methods like you describe. At least not with the built-in table view.
One reason is that it just doesn't scale to arbitrary content. If you let section headers stack up what should happen when the entire screen is full of headers? How would the user be able to comfortably see and interact with the content under the 6th or 7th section when there is only a few pixels left to show the content because the rest of the screen is taken up by header for sections that the user is obviously not interested in.
You probably want to rethink your UI. Either go with the standard section headers, make some cool light-weight tabs, a custom harmonica control or something entirely different. Maybe even a hierarchical structure depending on the amount of content you want to present.
I have a UITableView with 2 sections in it. I have enabled rearranging in my table view, but I have a strange problem.
I do not want the user to be able to rearrange rows between sections (I only want users to be able to rearrange rows within their section). If I try to drag a row from the first section to the second section, it will not allow me, which is what I want. If I drag a row from the second section to the first section, it WILL let me, which I do not want.
Is this a bug in Apple's frameworks or is this actually how it is supposed to behave, and how can I get the behaviour I want?
EDIT: I'm experiencing some inconsistencies here. Earlier I was unable to drag a row from the first to the second section but now I can. How do I disable rearranging between sections?
I'm not aware of a specific bug, but have you been overriding tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath: explicitly to check the section the row is being attempted to move into? Maybe you're not and the default behavior just happens to work one way and not the other?
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.