Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7977009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:04:11+00:00 2026-06-04T09:04:11+00:00

So I have a UITableViewCell subclass that needs to know whether the UITableView is

  • 0

So I have a UITableViewCell subclass that needs to know whether the UITableView is currently scrolling or not to update the UI. So I had a property pointing to the UITableView in the subclass and I have the following method delegate for the UIScrollView delegate:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    CGFloat scrollOffset = scrollView.contentOffset.y;
    CGFloat contentHeight = scrollView.contentSize.height - kLoadMoreOffset;

    if (scrollOffset >= contentHeight && loadMore && [self.nextPaginationURL_ isNotNull]){
        loadMore = NO;
        [self loadMore];
    }

    self.isScrolling = [NSNumber numberWithInt:1];
}

-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate  
{
    if (!decelerate){
        self.isScrolling = [NSNumber numberWithInt:0];
        NSLog(@"FIRING NOTIF END DRAGGING");
         [self showLoadMore];
    }
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
     NSLog(@"FIRING NOTIF END DECEL");
    self.isScrolling = [NSNumber numberWithInt:0];
    [self showLoadMore];

}

Is scrolling is essentially a NSNumber to indicate whether the scroll view is scrolling or not. I am passing this to the UITableViewCell to later on be used in the class, to see if the state is scrolling or not. I was planning to use KVO but it is impossible to do that with just a BOOL (or if it’s possible let me know). Is there a more elegant way to do this?

I have an assign property in my UITableViewCell as follows

@property (nonatomic, assign) BOOL isScrolling

and when I am initing my UITableViewCell subclass I am assinging isScrolling with the isScrolling on the UITableView. I guess my biggest concern with this approach is that if I change isScrolling on the UIScrollView delegate, will the isScrolling property on the UITableViewCell subclass also reflect the change?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:04:13+00:00Added an answer on June 4, 2026 at 9:04 am

    No it will not do that, you need to notify the visible cells manually about the change. Write a method to do the work for you and just call it from the delegate methods:

    - (void)notifyCellsOfScrolling:(BOOL)isScrolling_
    {
        // Small optimization, if the state has not changed we don't need to notify.
        if (self.isScrolling == isScrolling_)
            return;
    
        self.isScrolling = isScrolling_;
        for (UITableViewCell *cell in [self.tableView visibleCells])
            [cell setIsScrolling:isScrolling_];
    }
    

    You must also setup the proper state from cellForRowAtIndexPath.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UITableView subclass and a UITableViewCell subclass that I'm using for cells.
I have a subclass of UITableViewCell that I create for a UITableView. Let's say
Similar to this question I have a custom subclass of UITableViewCell that has a
I have a UITextView subclass that has an NSIndexPath property that is inside a
I have a property, specifically a UIActivityIndicatorView in a (reusable) subclass of UITableViewCell .
I created a subclass of UITableViewCell and added two identical UIView s that have
Now I know that the UITableViewCell by default have a imageView however I tried
I have a custom UITableViewCell subclass. I have set the contentView of my cell
I have a UISwitch inside a custom UITableViewCell (the subclass of which I call
I have a UITableViewCell that contains a UIScrollView . The UIScrollView contains a different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.