Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suggestion for UITextView is under floating header for UITableView

I have floating headers for my UITableView (which I want). But it looks quite bad when the suggestion view for the UITextView in the cell above is under the header.

Seems like no one has had this problem before. Any suggestions?

Both the header cell and UITableViewCell is loaded from Xib.

The floating header have an alpha on its second topmost view so it's a bit see through.

Floating header is above suggestion dialog for UITextView

This is how it looks in "Debug View Hierarchy":

enter image description here

like image 716
Sunkas Avatar asked Feb 08 '16 15:02

Sunkas


People also ask

How to add header and footer in UITableView?

There are two ways that we can add the header and footer, one way is to add it in using Interface Builder and the other way is to do it with code. In this tutorial we will be using both Interface Builder as well as code. The first thing that we need to do is to set up the UITableView and get it to show some data.

What is estimatedheaderheight in UITableView?

UITableView.automaticDimension is what enables AutoLayout to calculate the height of each cell at runtime. estimatedHeaderHeight should be set to a rough estimate of the total height of its content to display the scrolling indicator. These properties can be set in the Size Inspector when selecting the TableView in your storyboard.

Why use a UITableView instead of a Tableview?

Table views are more versatile than you might think. For example, many developers make their life harder using a scroll view when a UITableView would be a better choice. Finally, architecture is crucial for table views.

What are the cells of UITableView?

The cells of UITableView are instances of UITableViewCell or its subclasses. It is the table view that adds, removes, and arranges cells in its view hierarchy. Table views reuse cells that go out of the screen to display new elements, so that:


2 Answers

What if you did something like 'pull' the UITextView out of the table when the user exits it. You could align it over the top and do a nice transition to the editing state perhaps with the table view showing through a blurred overlay or something, but that would allow you to take control of the editing state instead of having it mostly in the hands of the UITableView which was not really designed for multi-line editable cell content.

like image 103
Michael Avatar answered Oct 19 '22 17:10

Michael


What if you send that UITextView to the front of the stack?

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/index.html#//apple_ref/occ/instm/UIView/bringSubviewToFront:

I suspect that if it is behind the view below it, that the autocorrect view may also obey the view index of the UITextView.

like image 26
Brian Trzupek Avatar answered Oct 19 '22 17:10

Brian Trzupek