contentoffset

Animating UICollectionView contentOffset does not display non-visible cells

社会主义新天地 提交于 2019-12-04 08:19:13
问题 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: - (void)beginAnimation { [UIView animateWithDuration:((self.collectionView.collectionViewLayout.collectionViewContentSize.width - self.collectionView.contentOffset.x) / 75) delay:0 options:(UIViewAnimationOptionCurveLinear | UIViewAnimationOptionRepeat |

Animating the offset of the scrollView in a UICollectionView/UITableView causes prematurely disappearing cells

孤街醉人 提交于 2019-12-04 02:49:19
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 here is #2.) The cells are roughly 280 points high, so only the active cell is fully visible on the screen. The user doesn't directly scroll the view to navigate, instead, she swipes the active cell horizontally to advance to the next cell. We then do some fancy animations and scroll the UICollectionView so the next cell is in the "active" position,

UICollectionView contentOffset changes with custom layout

瘦欲@ 提交于 2019-12-03 04:36:12
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 should be flush with the line). I'm loading the collection view layout in interface builder. It seems that my problem is very similar to this one , however the solutions there don't work for me. I tried modifying collectionViewContentSize in my layout implementation to ensure it was always greater than the size of the collectionView. Although this

Animating UICollectionView contentOffset does not display non-visible cells

☆樱花仙子☆ 提交于 2019-12-02 22:14:57
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: - (void)beginAnimation { [UIView animateWithDuration:((self.collectionView.collectionViewLayout.collectionViewContentSize.width - self.collectionView.contentOffset.x) / 75) delay:0 options:(UIViewAnimationOptionCurveLinear | UIViewAnimationOptionRepeat | UIViewAnimationOptionBeginFromCurrentState) animations:^{ self.collectionView.contentOffset = CGPointMake

Changing between colors based on UIScrollView's contentOffset

我与影子孤独终老i 提交于 2019-12-01 06:29:59
I have a horizontal UIScrollView that has a width of 960 , enough to hold 3 UIViewController view's. Each view simply has a background color. The first is pink, the second is blue, and the third is green. I want to blend/mix/fade the visible colors together as the user scrolls. So if you were scrolling from page 1 (pink) to page 2 (blue), there would be some type of mix/blend/fade of pink and blue before finally landing on the final blue color when the user fully swiped to the 2nd page. I found a question about exactly what I'm trying to do, and I have implemented the answer which can be found

UITextView setText should not jump to top in ios8

假装没事ソ 提交于 2019-11-30 15:06:11
Following iOS 8 code is called every second: - (void)appendString(NSString *)newString toTextView:(UITextView *)textView { textView.scrollEnabled = NO; textView.text = [NSString stringWithFormat:@"%@%@%@", textView.text, newString, @"\n"]; textView.scrollEnabled = YES; [textView scrollRangeToVisible:NSMakeRange(textView.text.length, 0)]; } The goal is to have the same scrolling down behaviour as the XCode console when the text starts running off the bottom. Unfortunately, setText causes the view to reset to the top before I can scroll down again with scrollRangeToVisible. This was solved in

UITextView setText should not jump to top in ios8

随声附和 提交于 2019-11-29 21:49:14
问题 Following iOS 8 code is called every second: - (void)appendString(NSString *)newString toTextView:(UITextView *)textView { textView.scrollEnabled = NO; textView.text = [NSString stringWithFormat:@"%@%@%@", textView.text, newString, @"\n"]; textView.scrollEnabled = YES; [textView scrollRangeToVisible:NSMakeRange(textView.text.length, 0)]; } The goal is to have the same scrolling down behaviour as the XCode console when the text starts running off the bottom. Unfortunately, setText causes the

UITableView contentOffSet is not working properly

孤人 提交于 2019-11-28 19:23:02
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 headerview I hides it using below code. self.tableView.contentOffset = CGPointMake(0, 40); //My searhbar height is 40 But at times contentOffSet is not hiding headerview. What can be the mistake. This worked for me: // contentOffset will not change before the main runloop ends without queueing it, for iPad that is dispatch_async(dispatch_get_main

UITableView contentOffSet is not working properly

非 Y 不嫁゛ 提交于 2019-11-27 12:15:46
问题 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 headerview I hides it using below code. self.tableView.contentOffset = CGPointMake(0, 40); //My searhbar height is 40 But at times contentOffSet is not hiding headerview. What can be the mistake. 回答1: This worked for me: // contentOffset will

How to keep UITableView contentoffset after calling -reloadData

谁都会走 提交于 2019-11-26 21:39:20
CGPoint offset = [_table contentOffset]; [_table reloadData]; [_table setContentOffset:offset animated:NO]; //unuseful // __block UITableView *tableBlock = _table; // [self performBlock:^(id sender) { // [tableBlock setContentOffset:offset]; // } afterDelay:2]; I know don't know of any delegate method which gets called after reloadData . And using afterDelay:2 which is kind of a hack may be too short or too long, so how can I implement it? I was recently working with reloadData -- reloadData doesn't change the contentOffset or scroll the table view. It actually stays the same if the offset is