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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:05:52+00:00 2026-06-11T16:05:52+00:00

Ok I am trying to change the scrollView page back and forth by using

  • 0

Ok I am trying to change the scrollView page back and forth by using a unbutton? Now the code I am using works perfect in the simulator but as soon as I go to the device it works once then every now and then? Any clues why this would be happening?

- (IBAction)changeScrollPage:(id)sender {

if (pageControlUsed)
{
    return;
}

CGFloat pageWidth = _scrollView.frame.size.width;
int page = floor((_scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
_pageControl.currentPage = page;

if ( sender == _rightBTN) {
    NSLog(@"right");

    page += 1;

    [_scrollView scrollRectToVisible:CGRectMake(page*_scrollView.frame.size.width, 0, self.view.frame.size.width, self.view.frame.size.height) animated:YES];

} else if ( sender == _leftBTN) {
    NSLog(@"left");
    page -= 1;
    [_scrollView scrollRectToVisible:CGRectMake(page*_scrollView.frame.size.width, 0, self.view.frame.size.width, self.view.frame.size.height) animated:YES];
}

}

  • 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-11T16:05:53+00:00Added an answer on June 11, 2026 at 4:05 pm

    You can also use UIButton.tag property:

    rightBTN.tag = 1;
    
    leftBTN.tag = 2; 
    
    if ( sender.tag == 1)
    
    {
    
    NSLog(@"right");
    
    
    page += 1;
    [_scrollView scrollRectToVisible:CGRectMake(page*_scrollView.frame.size.width,0,self.view.frame.size.width,self.view.frame.size.height) animated:YES];
    
    }
    else if ( sender.tag == 2)
    
    {
    
    NSLog(@"left");
    
    page -= 1;
    
    [_scrollView scrollRectToVisible:CGRectMake(page*_scrollView.frame.size.width0,self.view.frame.size.width, self.view.frame.size.height) 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 change the stdout of the system function using select. But it
Trying to change a theme in magento 1.7. Editing the page.xml file but the
Am trying to change the button frame according to the orientation change but button
I am trying change from Delegates to Parallel.ForEach I see the below works fine.
I'm new to android but I've done the notepad tutorial. Now I'm trying to
Trying to change/modify the source of any/all iframe on the page where the src
I'm trying to change background color of ImageView, but it updates only after I
I'm trying to skin a ScrollViewer in WPF using XAML but have been faced
I'm trying change text before I get feeds. But the text changes after I
I am trying change an UIImageView from other viewControllers, but I don't know why

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.