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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:38:44+00:00 2026-05-26T10:38:44+00:00

I have created two buttons with pagescrolling. Now by clicking on one button the

  • 0

I have created two buttons with pagescrolling. Now by clicking on one button the other button should be visible. How would it possible to get index of the other button when performing action method of the current button?

Here is the code for creating the buttons:

     for (int i = 0 ; i < numberOfPages ; i++)
{

     pageFrame = CGRectMake(i * scrollView.bounds.size.width, 0.0f, scrollView.bounds.size.width, 416) ;


    btnSettingButton=[[UIButton alloc]initWithFrame:pageFrame ];
   [ btnSettingButton setFrame:CGRectMake(i * (scrollView.bounds.size.width)+50, 260, 20, 20)];
    btnSettingButton.tag=i;
    [btnSettingButton setImage:[UIImage imageNamed:@"Settings Icon.png"] forState:UIControlStateNormal];

    [scrollView addSubview:btnSettingButton];
    [btnSettingButton setHidden:YES];
  //  [btnSettingButton release];  


    UIButton  *btnCheckButton=[[UIButton alloc]initWithFrame:pageFrame ];
    [ btnCheckButton setFrame:CGRectMake(i * (scrollView.bounds.size.width)+250, 260, 20, 20)];
    [btnCheckButton setImage:[UIImage imageNamed:@"NO.png"] forState:UIControlStateNormal];


   [btnCheckButton addTarget:self action:@selector(checkBoxClicked:) forControlEvents:UIControlEventTouchUpInside];

  //  [btnCheckButton addTarget:self action:@selector(changePage:) forControlEvents:UIControlEventTouchUpInside];


    [scrollView addSubview:btnCheckButton];
    [btnCheckButton release];  
  • 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-26T10:38:44+00:00Added an answer on May 26, 2026 at 10:38 am

    UIButton has a tag property. You can set counter to tag and then check which button was clicked.

    btnCheckButton.tag = i;
    

    Action:

    -(void)checkBoxClicked:(UIButton*)sender{
        if (sender.tag == 0){//button into the first page
        }
        if (sender.tag == 1){//second
        }
    }
    

    In order to find button on your view use method viewWithTag:

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

Sidebar

Related Questions

I have created two JavaScript files. One file is "validators.js" and the other is
I have two buttons on my application. One button starts a new Game (lets
I have created two buttons using the following XAML code. <Button x:Name=Button1 Width=100 Content=Button1
I have created a custom dialog, And I have inserted two buttons, one is
I have created an alert view with two buttons using the following code: UIAlertView
I have created an item swapper control consisting in two listboxes and some buttons
I have created two forms in my Windows Application. One Form acts as a
Let's say I have created two objects from class foo and now want to
Well as I have posted earlier too...I have created a site in two languages.One
I have created two link buttons dynamically: for (int i = 0; i <

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.