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.
Related
I need to display some content inside a grouped table view. At the same time, a cell inside my table has content that exceeds its bounds. I do not want user to scroll to view the entire content.
As an alternative, I want to make this cell such that it has a paged view - the pages are created on the fly based on content length. I will use its backgroundView property which will lay out as pages.
I found UIPageViewController but its design is too complex just for my one cell. Also I could not grasp many parts in it.
I found this library named Leaves but I am not sure there are many examples that have used it successfully. I do not know what I would need to modify in it so as to fit it inside my single cell. The example that is given with it successfully shows PDF and Image along pages, but there is no example of plaintext rendering.
Any pointers? Any other sources that can suit my purpose?
Why don't you use the cell view that would resize itself according to the text contet. So if some cells have larger text content and some have smaller text it would automatically resize the cell. Here is a two part tutorial that does exactly the trick you are looking for. Hope it helps you out.
http://www.raddonline.com/blogs/geek-journal/iphone-sdk-resizing-a-uitableviewcell-to-hold-variable-amounts-of-text/
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.
I am trying to do something like what FaceBook has done. Whereby it limits the number of cells it display. If the user would like to more items, he/she will scroll down the tableview and it will display more.
How do I go about doing so? Any tutorial out there? Sorry but I didn't know what to search for.
This behaviour is implemented in STableViewController.
It basically checks the scroll position of the underlying UIScrollView of the UITableView to see whether it has reached the end of the page and then loads more content if it has. It also uses a custom tableFooterView to indicate that it is loading content.
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.
From the docs:
In the plain style, section headers
and footers float above the content if
the part of a complete section is
visible. A table view can have an
index that appears as a bar on the
right hand side of the table (for
example, "a" through "z"). You can
touch a particular label to jump to
the target section.
I find that very hard to grasp. First, this one:
if the part of a complete section is visible
What do they mean by this? This is paradox. Which one is it?
A) Table must be exactly the height of that section. If I have 5 Rows, and each row is 50px high, I must make it 5*50 high. The full section must be visible on the screen. Otherwise, if I have 100 rows but my table view is only 400 high, this will not apply. Nothing will float above my content. Sounds wrong.
B) It doesn't matter how high my table view actually is. Header and Footer is floating above the content and I can scroll the section. Makes more sense. But is completely against this nonsense making sentence: 'if the part of a complete section is visible'
And: What sense does it make when Section Headers / Footers float above the section content when there are multiple sections with Header / Footer? The user would have to scroll to death until reaching the end of first section, until the whole thing can move to the second section? Or could she drag the header / footer to move on?
Can anyone explain it better than they did?
It's easiest to explain through an example. Launch your Contacts app and scroll through your contacts. That's a UITableView with UITableViewStylePlain. The table has one section per letter. You can see the gray section headers "floating" above the table, meaning that once a section header reaches the top of the view, it remains in place while the table view scrolls underneath it. When the last cell from a section scrolls off the top of the view, the section header scrolls off the view along with it.