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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:20:21+00:00 2026-06-16T08:20:21+00:00

I am trying to set the position of a UIScrollView by using contentOffset as

  • 0

I am trying to set the position of a UIScrollView by using contentOffset as such:

- (void) navigateToTableViewPosition:(CGPoint)contentOffset {
    NSLog(@"Position set method gets called...");
    NSLog(@"%@", NSStringFromCGPoint(contentOffset));
    [mainScrollView setContentOffset:contentOffset animated:YES];
}

I call this method from another view controller before I dismiss it, and everything checks out. I pass the argument correctly, and the method gets called (checked it with NSLog), but the scroll view does not move…

What is funny is that when I call this method from the view controller, in which it is located, it works fine. Only when I call it from another view controller, it stops working.

Just for future reference, here is the calling method:

MainViewController *mainView = [[MainViewController alloc] init];
[mainView navigateToTableViewPosition:contentOffset];

Content offset is a CGPoint I set beforehand. It doesn’t matter here; besides, it gets passed correctly anyways.

  • 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-16T08:20:22+00:00Added an answer on June 16, 2026 at 8:20 am

    Try this, You have to send notification from other viewcontroller when you want to change ..

        [[NSNotificationCenter defaultCenter] postNotificationName:@"changepostion"        object:NSStringFromCGPoint(CGPointMake(contentOffset.x, contentOffset.y))];
    

    in mainviewcontroller

      -(void)viewDidLoad
    
      {
         [[NSNotificationCenter defaultCenter] removeObserver:self];
             [[NSNotificationCenter defaultCenter] addObserver:self    selector:@selector(navigateToTableViewPosition:) name:@"changepostion" object:nil];
    
      }
    
    - (void) navigateToTableViewPosition:(NSNotification *)notification
      {
            contentOffset =CGPointFromString([notification object]);
    
       NSLog(@"Position set method gets called...");
       NSLog(@"%@", NSStringFromCGPoint(contentOffset));
        [mainScrollView setContentOffset:contentOffset animated:YES];
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to absolutely position a TinyMCE editor at a set position using
I'm trying to set the position of the Messages.app chat window using AppleScript. tell
I'm trying to set the caret position in a contenteditable div layer, and after
I am trying to set my gridview (asp.net) position to absolute when the gridview
I am trying to set the Media Elements position by following code: MediaElement musicPlayer
I am having a real headache trying to set a node's local position to
I'm trying to place a button. I have its position set to absolute, so
I'm trying to fire a Notification in a method called setPosition in one class,
I am trying to set a GPS position on my emulator with telnet and
I am trying to position some divs inside another container, When I set position:

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.