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 7623899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:49:21+00:00 2026-05-31T04:49:21+00:00

I have a UIViewController. Its view contains a UITableView as a subview. On viewDidAppear,

  • 0

I have a UIViewController.

Its view contains a UITableView as a subview. On viewDidAppear, the UIViewController calls the UITableView’s -(void)flashScrollIndicators.

The UIViewController also observes a notification “SomethingHappened”. When this happens, the UIViewController adds another small subview (a 30px high semi-transparent bar displaying a label “something happened”) to its view. Meanwhile the contentInset of the UITableView is set to 30px at the top and the contentOffset is set to -30px.

All this happens in a UIView Animation that nicely pushes the bar on the view and moves the tableview content down a little, without losing the ability to scroll the content behind the semi-transparent bar later on.

- (void)viewDidLoad
{
    [super viewDidLoad];    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addMessageView:) name:@"SomethingHappened" object:nil];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];    
    [self.tableView flashScrollIndicators];
}

- (void)addMessageView {

    self.statusMessageView = [[FFStatusMessageView alloc] initWithFrame:CGRectMake(0, -kMessageViewHeight, self.view.frame.size.width, kMessageViewHeight)];
    self.statusMessageView.autoresizingMask = UIViewAutoresizingFlexibleWidth;


    void (^animations)(void) = ^{
        [self.view addSubview:self.statusMessageView];
        self.statusMessageView.frame = CGRectMake(0, 0, self.view.frame.size.width, kMessageViewHeight);
        self.tableView.contentInset = UIEdgeInsetsMake(kMessageViewHeight, 0,0,0);
        if (self.tableView.contentOffset.y == 0) self.tableView.contentOffset = CGPointMake(0, -kMessageViewHeight);
    };

    [UIView animateWithDuration:0.4 animations:animations];
}

The result looks very nice. Here is the problem: “SomethingHappened” typically is posted/observed at roughly the same time the tableview flashes its scroll indicators. This makes the scroll indicator flash behave really odd – it slides in from the left and over the whole content before it lands on the right edge where it should be.

Should I delay one of the animations (indicator flash or bar placement)? How can I know whe it is safe to start the seconds one?

  • 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-05-31T04:49:23+00:00Added an answer on May 31, 2026 at 4:49 am

    I’m using a workaround now. I added two BOOL ivars (_animatingTableView and _waitingToFlashIndicators) to know the state of the animations.

    - (void)viewDidLoad
    {
        [super viewDidLoad];    
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addMessageView:) name:@"SomethingHappened" object:nil];
    }
    
    - (void)viewDidAppear:(BOOL)animated
    {
        [super viewDidAppear:animated];    
        if (! _animatingTableView) {
            [self.tableView flashScrollIndicators];
        } else {
            _waitingToFlashIndicators = YES;
        }
    }
    
    - (void)addMessageView {
    
        _animatingTableView = YES;
        self.statusMessageView = [[FFStatusMessageView alloc] initWithFrame:CGRectMake(0, -kMessageViewHeight, self.view.frame.size.width, kMessageViewHeight)];
        self.statusMessageView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
    
        void (^animations)(void) = ^{
            [self.view addSubview:self.statusMessageView];
            self.statusMessageView.frame = CGRectMake(0, 0, self.view.frame.size.width, kMessageViewHeight);
            self.tableView.contentInset = UIEdgeInsetsMake(kMessageViewHeight, 0,0,0);
            if (self.tableView.contentOffset.y == 0) self.tableView.contentOffset = CGPointMake(0, -kMessageViewHeight);
        };
    
        void (^completion)(BOOL) = ^(BOOL finished){
            _animatingTableView = NO;
            if (_waitingToFlashIndicators) {
                [self.tableView flashScrollIndicators];
                _waitingToFlashIndicators = NO;
            }
        };
    
        [UIView animateWithDuration:0.4 animations:animations completion:completion];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIPopOverController that shows a UIViewController with a UITableview in its view.
I have a UIViewController, and I've added two subviews to its view. One subview
I have a problem with data in UITableView. I have UIViewController, that contains UITableView
I have a UIViewController that contains a subview and a UIToolbar. I'm trying to
I have a view controller which contains a UISearchBar @interface TradeFindHeaderViewController_iPhone : UIViewController {
I have a UIViewController that materializes its view in loadView (i.e. no nib). Per
I have a UIViewController subclass which is having its view created programmatically within the
I have differents UIViewController that contains components that appear and disappear from the view
I have an UIViewController with several subviews in its view property ( UISearchbar and
I have a pointer to a UIView . How do I access its UIViewController

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.