UITableView horizontal scroll indicator - iphone

I have a table view inside a navigation controller, which is one view for a tab bar.
Everytime I launch the app, the horizontal scroll indicator flashes briefly when i select this tab.
Could this be related to the initial tab selected, which does contain a scrollview?
I was under the impression that table views couldn't scroll horizontally?
It doesnt seem to affect the app, just annoying thats all.

Do you do programmatic scrolling in your view?
We did this flashing on purpose in one of our apps, using some code to set a new scroll position (0) with animation enabled.
EDIT: There is also the method: flashScrollIndicators in UIScrollView (a UITableView also being a UIScrollView).

Related

Swift - UIButton as overlay on UIScrollView

I have a scroll view which contains different ui components such as text fields, labels etc.
The scroll view takes almost the full size of the screen. Logically separated, I want to add/display a button which is not a part of the content of the scroll view.
This leads to the problem that my button doesn't react on my touches. In case, I reduce the size of the scroll view so that the frames don't interfere with the ones from the button, everything works as expected.
I tried to bring the button to the front (view.bringSubviewToFront(infoButton)) but it still doesn't work.
I think you want to implement something like 'Gmail app, a plus button is floating at the bottom right of the screen.
add your scroll view to view and add other elements to scroll view:
view.addSubview(yourScrollView)
yourScrollView.addSubview(yourButton)
yourScrollView.addSubview(yourLabel)
after you finished adding scrollView's sub views it's time to add your button to -> View (not scroll view)
and everything should work fine as you expected
Issue is solved!
It is a matter of how you ad your sub views to the main view. In my case, I added the info button first to the main view followed by adding the scroll view to the main view.
You need to change the order. First you add the scroll view to the main view and then the button.

Temporary extra space on top of UICollectionView w/ navigation bar

There are a couple of things wrong with my UICollectionView and corresponding cells that are under a navigation bar. First of all, when the view first loads, there seems to be some extra space on the top. But when I do a little scroll down (not a full scroll), it adjusts to normal height. Check out the images below for what I mean. this is what I see when i first open the view controller
after a little scroll, not a full one (There are 10 cells in this VC), i see this. Why is this happening?
In your viewcontroller uncheck Adjust Scroll View Insets
Go to your storyboard in your view controller select your collectionView and from the side pane select size inspector there is an option of content insets set it to Never.

Iphone tableview horizontal scrollbar appear

I have tableview that scroll vertically. My question is when first this view is loaded, horizontal scrollbar appears at the bottom of tableview and disappears. It only happens when the view loads at the first time. I wonder why this is happening.
I'd hazard a guess that you accidentally checked the “Horizontal Scrollers” box in the table's properties in Interface Builder. To turn them back off again, either find that (under the “Scroll View” section of the inspector) and uncheck it, or just set the table view's showsHorizontalScrollIndicator property to NO in your controller's -viewDidLoad.

UITableView Custom Scrollbar

How can I create a custom scrollbar for a UITableView?
I want to remove the default one that pops up when tracking begins and that disappears when tracking ends. I want, instead, to have one similar to that in a computer program: (a) it's on the right side of the screen and permanently visible; (b) manually scrolling the bar will scroll the UITableView to the appropriate position; (c) scrolling the UITableView will scroll the scroll bar appropriately (without showing the default one that Apple provides).
The difficulty in (b) and (c) is that, as far as I know, Apple only provides methods to scroll to a particular row/section, but not to scroll to three-fourths of the way down a row. So, for example, if I want to scroll the scroll bar, the UITableView will subsequently only scroll to the top of a row/cell. The method I'm talking about is:
- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated
Has anyone implemented a custom scroll bar in their UITableView before? Or can someone help me figure out a way to solve the following problems:
scrolling to any point in the UITableView instead of to the start of a cell
removing the default scroll bar and preventing it from appearing
changing the scroll bar image/animation/whatever as the UITableView is scrolled
Thanks!
UITableView inherits from UIScrollView, that means you can use any of the existing functions. In your case
– (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated
should do the job. It moves the table to any position you want.
To disable the existing scroll indicator, use
table.showsVerticalScrollIndicator = NO;
And to add your own, just add your custom view!

How to display scrollbar in UITableView

I want to display some kind of indication to guide user to scroll.
Usually when we touch the UITableView scrollbar appears if needed. But I want this scrollbar indication already displayed on my tableview.
How is it possible to do so?
If you have a table view that goes offscreen, you can call
[self.tableView flashScrollIndicators];
and they will flash to show the user that they are there. This is usually put in viewDidAppear.
(If you inherit from UITableViewController then you will have a self.tableView instance variable, if not then substitute another UITableView.)
If you a scroll view's entire contents fit within its view then no scroll bars are displayed; to test this display a table view with only one cell. If the content size is larger than the view's frame then scroll bars will be displayed; only then will [self.tableView flashScrollIndicators]; actually flash scroll indicators.
There's no way to force the scrollbar to appear, short of messing with the internals of UITableView(which you shouldn't do), or redesigning your own table view class.
Per the documentation of UIScrollView's showsVerticalScrollIndicator property: "The indicator is visible while tracking is underway and fades out after tracking."