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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:23:53+00:00 2026-05-25T18:23:53+00:00

hi i have uiscrollview and uipage control and in uiscrollview i have buttons (custom

  • 0

hi i have uiscrollview and uipage control and in uiscrollview i have buttons (custom buttons)

and the coading is as follows

bodyView                                            = [[UIScrollView alloc]initWithFrame:CGRectMake(0,
                                                                                                    0,
                                                                                                    320,
                                                                                                    415)];
bodyView.userInteractionEnabled                     = YES;
bodyView.pagingEnabled                              = YES;  
bodyView.contentSize                                = CGSizeMake(640,self.bodyView.frame.size.height);
bodyView.showsHorizontalScrollIndicator             = NO;
bodyView.scrollEnabled                              = YES;
bodyView.showsVerticalScrollIndicator               = NO;
bodyView.scrollsToTop                               = NO;
bodyView.delegate                                   = self;
bodyView.canCancelContentTouches                    = NO;
bodyView.delaysContentTouches                       = NO;

[self.view addSubview:self.bodyView];

pageControl=[[UIPageControl alloc]initWithFrame:CGRectMake(0,425,320,10)];
pageControl.numberOfPages = kNumberOfPages;
pageControl.currentPage = 0;
pageControl.userInteractionEnabled=YES;
pageControl.multipleTouchEnabled=YES;

[pageControl addTarget:self action:@selector(changePageNavigation) forControlEvents:UIControlEventTouchUpInside];
[pageControl addTarget:self action:@selector(changePageNavigation) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:pageControl]; 

[self.view bringSubviewToFront:bodyView];

- (void)createIcons{


    buttonCustom = [self createDynamicCustomButtons:CGRectMake(12, 103, 65, 65) 
                                              image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/pharmacy.png")] 
                                                tag:1];
    [bodyView addSubview:buttonCustom];

    labelCustom = [self createDynamicCustomLabels:CGRectMake(12,185, 80, 13) 
                                             text:NSLocalizedString(@"pharmacyTitle",nil)];
    [bodyView addSubview:labelCustom];

    buttonCustom = [self createDynamicCustomButtons:CGRectMake(120, 103, 65, 65) 
                                              image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/photo.png")] 
                                                tag:2];
    [bodyView addSubview:buttonCustom];

    labelCustom = [self createDynamicCustomLabels:CGRectMake(116, 185,80, 13) 
                                             text:NSLocalizedString(@"photo Title",nil)];
    [bodyView addSubview:labelCustom];

    buttonCustom = [self createDynamicCustomButtons:CGRectMake(227, 103, 65, 65) 
                                              image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/store_locator.png")] 
                                                tag:3];
    [bodyView addSubview:buttonCustom];

    labelCustom = [self createDynamicCustomLabels:CGRectMake(225, 185, 80, 13) 
                                             text:NSLocalizedString(@"StoreTitle",nil)];
    [bodyView addSubview:labelCustom];

    buttonCustom = [self createDynamicCustomButtons:CGRectMake(12, 208, 65, 65) 
                                              image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/coupons.png")] 
                                                tag:12];
    [bodyView addSubview:buttonCustom];

    labelCustom = [self createDynamicCustomLabels:CGRectMake(23, 290, 60, 13) 
                                             text:NSLocalizedString(@"couponsTitle",nil)];
    [bodyView addSubview:labelCustom];  

    buttonCustom = [self createDynamicCustomButtons:CGRectMake(120, 208, 65, 65) 
                                              image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/refill_by_scan.png")]
                                                tag:6];
    [bodyView addSubview:buttonCustom];

    labelCustom = [self createDynamicCustomLabels:CGRectMake(116, 290, 89, 13) 
                                             text:NSLocalizedString(@"Refill Title",nil)];
    [bodyView addSubview:labelCustom];      

    //buttonCustom = [self createDynamicCustomButtons:CGRectMake(224, 220, 65, 65) 
    //                                        image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/65x65_weekly_ad.png")] 
    buttonCustom = [self createDynamicCustomButtons:CGRectMake(227, 208, 65, 62) 
                                              image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/multi_scan.png")] 
                                                tag:7];
    [bodyView addSubview:buttonCustom];

    labelCustom = [self createDynamicCustomLabels:CGRectMake(225, 290, 86, 13) 
                                             text:NSLocalizedString(@"scanner",nil)];
    [bodyView addSubview:labelCustom];  



    buttonCustom = [self createDynamicCustomButtons:  CGRectMake(12, 313, 65, 65)
                                              image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/shopping_list.png")] 
                                                tag:9];
    [bodyView addSubview:buttonCustom];

    labelCustom = [self createDynamicCustomLabels:CGRectMake(15,395, 75, 13) 
                                             text:NSLocalizedString(@"ShoppinglistTitle",nil)];
    [bodyView addSubview:labelCustom];


    buttonCustom = [self createDynamicCustomButtons:CGRectMake(120, 313, 65, 65) 
                                              image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/weekly_ad.png")] 
                                                tag:8];
    [bodyView addSubview:buttonCustom];

    labelCustom = [self createDynamicCustomLabels: CGRectMake(120,395, 80, 13)
                                             text:NSLocalizedString(@"Weeklyads title",nil)];
    [bodyView addSubview:labelCustom];



    buttonCustom = [self createDynamicCustomButtons:CGRectMake(227, 313, 65, 65) 
                                              image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/gift_finder.png")] 
                                                tag:nil];
    [bodyView addSubview:buttonCustom];

    labelCustom = [self createDynamicCustomLabels:CGRectMake(237, 395, 60, 13) 
                                             text:NSLocalizedString(@"giftFinder",nil)];
    [bodyView addSubview:labelCustom];


    buttonCustom = [self createDynamicCustomButtons:CGRectMake(333, 103, 65, 65) 
                                              image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/shop.png")] 
                                                tag:4];
    [bodyView addSubview:buttonCustom];

    labelCustom = [self createDynamicCustomLabels:CGRectMake(344, 185, 60, 13) 
                                             text:NSLocalizedString(@"shop",nil)];
    [bodyView addSubview:labelCustom];


    buttonCustom = [self createDynamicCustomButtons:CGRectMake(440, 103, 65, 65) 
                                              image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/find_a_clinic.png")] 
                                                tag:11];
    [bodyView addSubview:buttonCustom];

    labelCustom = [self createDynamicCustomLabels:CGRectMake(439, 185,80, 13) 
                                             text:NSLocalizedString(@"clinicTitle",nil)];
    [bodyView addSubview:labelCustom];




    buttonCustom = [self createDynamicCustomButtons:CGRectMake(547, 103, 65, 65) 
                                              image:[UIImage imageFromPath:TKBUNDLE(@"Images.bundle/Images/HomeScreen/settings.png")] 
                                                tag:10];
    [bodyView addSubview:buttonCustom];

    labelCustom = [self createDynamicCustomLabels:CGRectMake(558, 185, 60, 14) 
                                             text:NSLocalizedString(@"settingsTitle",nil)];
    [bodyView addSubview:labelCustom];


}


//Begin - To create a icon's custom button ***Sujya***
-(UIButtonCustom *)createDynamicCustomButtons:(CGRect)frame image:(UIImage *)buttonImage tag:(int)tagValue 
{
    UIButtonCustom *customIconButton            = [UIButtonCustom buttonWithType:UIButtonTypeCustom];
    [customIconButton retain];
    //customIconButton.buttonType =UIButtonTypeCustom;
    [customIconButton setImage:buttonImage 
                      forState:UIControlStateNormal];
    [customIconButton addTarget:self 
                         action:@selector(btnIconClicked:) 
               forControlEvents:UIControlEventTouchUpInside];
    [customIconButton setTag:tagValue];
    frame.size.width=buttonImage.size.width;
    frame.size.height=buttonImage.size.height;

    [customIconButton setFrame:frame];
    return customIconButton;
}

i am able to scroll the view with out tapping on the button but on touching the button and i try to scroll but un able to scroll the view

can any one please tell me how to scroll on touching the buttton

  • 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-25T18:23:53+00:00Added an answer on May 25, 2026 at 6:23 pm

    If i have understood correctly, you want to scroll the scrollView by tapping a UIButton.
    UIScrollView has a method
    scrollRectToVisible:animated: to scroll programmatically your scrollView.

    You can try this:

    -(IBAction)switchToPG2{
        CGRect frame = self.scrollView.frame;
        frame.origin.x = frame.size.width * 1;//or the index of the page that you want
        self.pageControl.currentPage=1;
        frame.origin.y = 0;
        [self.scrollView scrollRectToVisible:frame animated:YES];
    }
    

    Hope this helps.

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

Sidebar

Related Questions

I have a UIScrollView that contains an image and a segmented control that allows
I have a UIScrollView that's around 600 pixels in height and 320 in width.
In my app i have to use two pages using UIPage Control. Now my
I have main UIScrollView with lots off buttons which i create like this: UIButton
I have a UIScrollView with paging enabled like the following: container = [[UIScrollView alloc]
I have UIScrollView in my view. Problem is that if I slightly scroll it
I have a UIScrollView with a UIView inside. I want to lock the x-axis
I have a UIScrollView with 2 pages, and I can scroll horizontally between them.
I have a UIScrollView and I'm calling scrollRectToVisible:animated:YES on it. I would like to
I have a UIScrollView that contains multiple UITableViews horizontally - all of which are

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.