The point at which the origin of the content view is offset from the origin of the scroll view.
Questions tagged [contentoffset]
140 questions
99
votes
6 answers
UITableView + Add content offset at top
I need to add some blank space to the top of my UITableView that does not affect the size of the content area. Shifting the content down or adding a blank cell is NOT what I want to do. Instead I just want an offset.
How?

bluefloyd8
- 2,266
- 2
- 24
- 20
66
votes
13 answers
How to keep UITableView contentoffset after calling -reloadData
CGPoint offset = [_table contentOffset];
[_table reloadData];
[_table setContentOffset:offset animated:NO]; //unuseful
// __block UITableView *tableBlock = _table;
// [self performBlock:^(id sender) {
// [tableBlock…

avincross
- 663
- 1
- 6
- 5
27
votes
4 answers
Smooth move of the contentoffset UIScrollView Swift
I would like to set the contentOffset of my scrollview programmatically when the contentOffset is between two points (please see the picture below) with Swift.
The problem is, I would like to add a smooth transition for the move, but I didn't find…

Jibeee
- 822
- 1
- 11
- 26
26
votes
7 answers
Animating UICollectionView contentOffset does not display non-visible cells
I'm working on some ticker-like functionality and am using a UICollectionView. It was originally a scrollView, but we figure a collectionView will make it easier to add/remove cells.
I am animating the collectionView with the following:
-…

ravun
- 1,523
- 9
- 27
- 45
26
votes
5 answers
UICollectionView contentOffset changes with custom layout
I have a UICollectionView with a custom UICollectionViewLayout (actually, I'm using this nice layout).
I set contentOffset = CGPointZero in viewDidLoad. After viewDidLoad, however, the offset is -20, and the content gets pushed down like so:
(It…

Evan Cordell
- 4,108
- 2
- 31
- 47
24
votes
15 answers
UITableView contentOffSet is not working properly
In viewWillAppear, I have added UISearchBar as my headerview of UITableView. When view loads, I hides UISearchbar under UINavigationBar using contentOffSet of UITableView. When user pull down the tableview the searchbar gets displayed.
After adding…

JiteshW
- 2,195
- 4
- 32
- 61
16
votes
2 answers
iOS7 Content Offset by 20 pixels for non existent Status Bars
I have a strange behaviour with my UIViews as I'm migrating to iOS7. It seems that they are sent a message to shrink by 20 pixels. I have removed the status bar from all my XIB files and explicitly set it to hidden in the application delegate. My…

Mike M
- 4,879
- 5
- 38
- 58
11
votes
3 answers
Animating the offset of the scrollView in a UICollectionView/UITableView causes prematurely disappearing cells
We have a UICollectionView with a custom layout very similar to UITableView (it scrolls vertically). The UICollectionView displays only 3 cells simultaneously, with one of them being the currently active cell:
[ 1 ]
[*2*]
[ 3 ]
(The active cell…

radutzan
- 343
- 1
- 3
- 10
9
votes
1 answer
iOS: `UICollectionview`, how to get a cell's `contentoffset` by it's `indexPath`
I'm using a UICollectionview with a circular layout. I'm trying to calculate the contentOffsetper item but with the circular layout the full contentsize does not seem match the content.
The collectionview's total contentSize = 780
The content…

Steven B.
- 1,429
- 2
- 19
- 38
9
votes
3 answers
Get current position of UIScrollView
I'm coming from Android and i'm getting a lot of headache in IOS. I need to make a scroll menu like a movie credits. I used the code below:
rol = scroll_view.contentOffset.y;
timer = [NSTimer scheduledTimerWithTimeInterval:.02 target:self…

Rafael Godinho Brandão
- 451
- 1
- 4
- 20
9
votes
5 answers
Detecting UIScrollView Position
I am trying to use a UIScrollView as a navigation device in my iOS application. Basically, I want the application to load specific content, based on the position of a paging-enabled UIScrollView. It is sort of like a navigation wheel.
Currently, I…

Gergely Kovacs
- 1,045
- 2
- 10
- 28
7
votes
4 answers
UITableView ContentInset and ContentOffset
I'm having trouble with the contentInset property. I have a UITableView, with dynamic cell sizes (AutoLayout). I'm setting the contentInset property to leave some space above the top of the content. But I'm getting the following result:
The…

Morpheus
- 1,189
- 2
- 11
- 33
6
votes
3 answers
How can I set the content offset of a FlatList in React Native?
I know that we can get the offset with
render() {
return
}
handleScroll = (event) => {
//get offset by using
//event.nativeEvent.contentOffset
}
But I'm not sure how to set it

MendyK
- 1,643
- 1
- 17
- 30
6
votes
3 answers
UIScrollview animation depending on content offset
I'm using a horizontal UIScrollView, and I want a background color transition depending on the x value of the content offset.
Example: The width of UIScrollView is 640px. When the content offset is equal to 0px, the background color must be red.…

Berendschot
- 3,026
- 1
- 21
- 43
6
votes
5 answers
UICollectionView contentOffset changes when keyboard appears
I am trying to implement PullDown To Search feature in my app. To implement this i just modified bit EGOTableViewPullRefresh
it is working good except an issue.
Issue
When user opens the application following screen shall appear. initially the…

thavasidurai
- 1,972
- 1
- 26
- 51