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

  • Home
  • SEARCH
  • 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 6085365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:37:50+00:00 2026-05-23T11:37:50+00:00

i want to create a cluster of buttons.for this i am using a loop

  • 0

i want to create a cluster of buttons.for this i am using a loop like this.

for (int i =0; i< [plistArray count];i++) {

    editButton = [[UIButton alloc]initWithFrame:CGRectMake(width-10, -3.6, 39, 35)];
    [editButton setImage:[UIImage imageNamed:@"DeleteButton.png"] forState:UIControlStateNormal];
    [editButton addTarget:self action:@selector(deleteObjectViewImage:) forControlEvents:UIControlEventTouchUpInside];
}

but when i clicked on any random button assigned function is not called.It called when i clicked first button(in a sequence 1,2,3).

  • 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-23T11:37:51+00:00Added an answer on May 23, 2026 at 11:37 am

    Here’s one:

        #define ButtonHeight 40
    
        #define OffsetBetweenButtons 20
    
        #define ButtonHeightPlusOffsetBetweenButtons (ButtonHeight+OffsetBetweenButtons)
    
    //create 6 buttons from 0,1,2,3,4,5 so totally 6 buttons
    for(int buttonIndex=0;buttonIndex<=5;buttonIndex++){
    
        UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    
        [button addTarget:self 
                   action:@selector(aMethod:)
         forControlEvents:UIControlEventTouchUpInside];
    
        [button setTitle:@"Button" forState:UIControlStateNormal];
    
        [button setImage:[UIImage imageNamed:@"DeleteButton.png"] forState:UIControlStateNormal];
    
        //Set offset in Y axis
        button.frame = CGRectMake(20.0, ButtonHeightPlusOffsetBetweenButtons * buttonIndex , 280.0, 40.0);
    
        //Set Tag for future identification
        [button setTag:buttonIndex];
    
        [YourView addSubview:button];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a Cluster Generic Service using script. We have Windows Server
I want to create conditional comments in XSLT. But when I use this: <!--
I want to create a cluster of RabbitMQ on EC2. I have created an
I want to create a cluster with 2 managed servers on 2 different physical
i want create something like link_to which can link to request for permission in
I want create a excel with Apache POI in java and I must insert
i want create image animation , i have 50 images with png format now
I want create module which update list of usb devices automatically (not only mass
We want to create a widget platform for a particular website. I couldn't find
I want to create a file in the current directory (where the executable is

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.