I created a TableView and added a UISearchBar from the storyboard.
The UISearchBarContoller didn't work for me so I decided to use the IBOutlet method.
The problem is when I'm scrolling down, the search bar goes up and gets behind the segment controller.
I couldn't find any questions about this or any fixes on the internet related to the IBOutlet and not the UISearchContoller.
Is there any way to make it collapse?
I know I can take it out of the TableView, but I want it to collapse into itself when scrolling.
I don't know how your storyboard or code is set up so I can only give guidelines.
A few guesses:
It seems that you've set up the searchBar as a cell of the tableview since it scrolls with the content. Try setting it out either outside (above) the tableView or as header (see answer 2)
If you've set it up as the tableHeaderView you need to be wary of the fact that UITableViewStylePlain will keep it at the top, but UITableViewStyleGrouped will not.
Related
When I first load data into my tableview it doesn't scroll even when UserInteractionEnabled is true, but when I click on top of the tableview the cell scrolling gets enabled.
Does anyone know why this might be the case?
UITableView could be tricky to answer. Let's check if you have few basics done right:
In Attribute inspector, make sure TableView has following
1- Scrolling Enabled is checked
2- User Interaction enabled is checked
Also in ContentView height is less than TableView in design
Let's start from these mentioned checks first
I've been searching for two days for a solution to this problem, and I just can't figure out a cohesive solution. What I'm trying to do is:
Have a UISearchBar with an extra button to the left like in this thread Adding button to left of UISearchBar.
Have a table view that shows the results that the UISearchBar is not part of, so that the search bar stays on screen even if you scroll down in the table view. I was only able to do this by separating the tableview and the search bar, meaning I can't use UITableViewController
Have refresh control on the table view. From this thread UIRefreshControl without UITableViewController it looks like I can't do this in a supported way if I can't use a tableViewController.
I've tried using the UIToolbar solution to adding a button to a UISearchBar, but the gradients don't really blend, so I'd prefer not to use that solution. I also haven't had any luck using any of the code snippets I've found here to add the button in a subclass in a way that can support autolayout for rotation.
Any help is much appreciated!
Perhaps you could make a custom object that just stacks a UISearchBar on top of a UINavigationBar and then use a UIBarButtonItem for the button that you are talking about. If you make this a re-usable custom object, you should be able to implement it app-wide.
I have an UITableView with a single cell that contains an UITextView. When calling -becomeFirstResponder on the UITextView my UITableView gets messed up by the automatic animation. This only occurs when the UITextView has to scroll down for the end of the text.
I already tried disabling scrolling on the UITableView.
Depending on the needs of your interface, you could probably do what you're asking by making the parent view controller an instance of UIViewController instead of UITableViewController (which is what provides that "slide to get out of the way of the keyboard" behavior).
Indeed, if your UI consists solely of a text view, you probably don't need a table view at all.
Harrr pirates!
I'm trying to make a data entry screen using a UITableViewController. It contains a grouped table view with two sections, each with a few (2 and 4) rows with a UITextField inside them.
When any of the UITextFields become first responder they scroll into view automatically. Great, you would say, but I want to scroll the whole section into view, not just the row containing the UITextField that became first responder.
I don't allow the user to scroll the UITableView by hand and I know to what position it should scroll to display correctly. However, I can't get my UITableViewController to stop automatically scrolling the UITextField into view for me.
Searching StackOverflow I can find a lot of questions about how to resize the UITableView when the keyboard appears, but this doesn't stop the automatic scrolling.
Any suggestions? Your help would be much appreciated!
TableView is basically an extension of scrollView therefore if you want to do the scroll yourself you should use the scrollview API.
Set the contectSize property to the size of the screen without the keyboard and the contentOffset to the location on the table you want to scroll to
I'm trying to add a UIView, in particular a UIImageVIew, after (that is, below, but not in a z-index sense) a UITableView but before (that is, above) a UITabBar.
You know, the typical "banner/adv space" that you can see everywhere.
My main problem btw is that i don't know exactly where to put it, as a subview of wich view specifically; the UITableView resize automatically according to the space left from the UITabBarController's main view height, minus the height of the tabbar.
I would like it to be put inside the UITableView instead of somewhere else beacuse it is more related to the content of the UITableView, but i have all the autoresizing problems of above. I've tried playing with autoresizingmask, and with the autoresizesubviews flag, but without success. I've even tried the footer ot the UITableView, but that is not fixed in position, it scrolls away if the table is long (expected, and normal).
Is there a way to add a subview in that point, stretching the table itself correctly?
Thanks everybody.
Use a normal UIViewController instead of a UITableViewController. Use the view controller's view as a container view in which you place the table view and the image view. Your view controller can still act as your table view's delegate and/or datasource.