Any way to make table view section title line fixed - iphone

As shown in pic, when trying slide table up, section title B line will move up as well, but will keep on top of screen until next section title line arrive to top of screen.
Is there anyway to let the section title line move as normal table cell, don't stay on the top of screen until next section title line arrived?

I dont know of how you would do this using the normal sections, you could fake it by adding extra cells to the table view which represent section headers though

There's an answer for this already here:
Change Default Scrolling Behavior of UITableView Section Header
Basically, use grouped style for the table and then provide your own UIViews for the table headers and cells to customise the look of them.

Related

Section Header of UITableview not pin at the top when scroll up - Swift

Normally, When I create table with style grouped, there are no any problem with section header. when I scroll up, the section header always stay at the top even when scroll pass it. I create one sample tableview using group style, section header not stay at the top when I scroll up like before. maybe do I miss some properties?.
Make sure style is set to Plain not Grouped.
Check below image:

Swift: UITableView scrolls back to top when section header height is changed dynamically

!
I have a tableView with a single section. The header of this section holds the Sort By label and the three ImageViews. The view below it is a UITableViewCell.
The first image shows the initial view of the section header. When the header is clicked (have added a tap gesture), I expand the section view by changing the constant of the height constraint programmatically (have created an outlet for the height constraint).
Everything works fine, the section header expands as desired. However the tableviewcell scrolls right to the top again. Meaning, if when the section header was not expanded and I had scrolled down to some level, as soon as the header view expands, the entire offset is lost and tableviewcell scrolls right back to the top. I do not want this. I want the table view cell to remain where it is and for the section header to expand and collapse over it. How can I achieve this? Please help.
it sounds like you might be doing this:
setContentOffset(CGPointZero, animated: true)
which you shouldn't do.

how to create a sectioned TableView for profile in iPhone

I saw this picture on Internet:
the section with the add Photo Frame and two rows (First, Last)...
How do you achieve a design like that!!!
I only know how to make rows (static and dynamic) in xCode using the full width of the screen but not in a single section but not making such a división and adding a frame out of the other two rows
my designs are like this
Any help I'll appreciate
thanks in advance
It's not really clear that the example you've given is actually embedding the first, last part into a table view. It could just as easily be a single cell that has embedded views with borders to look like rows. Here are a few ways I see to accomplish the view you've given.
Have them be actual rows - but use a custom cell layout that offsets the 'First' and 'Last' labels to be further to the right. Then create a UIImageView for the profile that sits on top of the UITableView cells, but inside of it. Basically insert it as the first subview of the UITableView. It should cover the top left of those top two cells. You can do this since those cells have a static known hight and you've set the left offset. Another option would be just inserting it into your top cell, but having it overflow the bounds and setting clipsToBounds = NO.
Make the entire top view a custom UIView that uses CALayers or CoreGraphics to manually draw the lines and layout such that it looks like part of the table view. Set that as the TableView header, or the first section Header.
There are a lot more things you can do like changing frame layout as well.
you can achieve this with the use of xib read carefully and if you don't understand anything you can ask me again it's bit tricky
in you xib create a UIView and design for your photo and firstname, lastname cells with the use of textfields image views and all and then take a UITableView.
now drag your UIView and drop it on your UITableView so that it will be considered as your table header and your first section now will be as you designed like photo with firstname and lastname fields.
i've done this in manier projects of mine so hope this way you can also do this thing and ask me if you need any help.

UITableView section appears over tableHeaderView

I have a UITableView instance to which I have added a header using the tableHeaderView property. I observe for changes in the contentOffset property to be able to move the header in the opposite direction, allowing it to stay at the top of the table when scrolled at least a certain amount.
I want to have it in this way because of two reasons. First, I want the scroll bar to cover the header. Secondly, I'm moving the header with the scrolled content for about 100 points, then I'm keeping it at the top.
Everything is fine except for one detail. The table view sections appear above the tableHeaderView. How do I get them to appear below?
EDIT: How do I get the sections of a UITableView to appear below the assigned tableHeaderView view in the view stack?
This is not a solution to the problem, but this way worked for me:
I simply pushed the titles into the array feeding the table view cells as strings and added them as cells with different cell identifiers than the cells i used otherwise.

UItableView custom cell with a plus button on the left side (outside table view)

I want to add a plus button outside my table view cell (on the left side), but the button should get scrolled if I am scrolling the table. Does anyone has a solution for this??? Also, there are 8 different sections in my table. There is no need to show that plus button for the first 7 sections, but there is a plus button in the 8th section clicking on which will increase the number of sections by 1. (the catch here is that the plus button is NOT INSIDE THE CELL and there are different sections where we will not show the plus button, so no UNIFORMITY).
I belive that the best solution to this is to create a custom section header (or footer) view and put the button there. It will "look" like it's outside the table, but it will be inside the given view.
In your case, only inside the section header/footer of section 7.
That button will scrool along with the table, as the section header/footer will.
Or, alternatively, you could have an "empty" section 8 (with no rows, but with a header) and display the button there. If you want the button displayed, you should return the number of section as "8", if you want the button hidden, return section count as "7".