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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:07:55+00:00 2026-05-25T16:07:55+00:00

I am developing an iPhone application where i need to show UIButtons with back

  • 0

I am developing an iPhone application where i need to show UIButtons with back images horizontally(each row two buttons with back images) with scrollbar provision in a View. I have a tabbar application created. Please refer the attached sample image. How can i develop such screen? Do i need create tableview with just ONE row, where i can add UIButtons with back images horizontally (or) How can i achieve it easily? Is there a sample program available?
Note: When clicking on button, i also need to know which button is clicked. I have actions for all buttons..

Please help!

enter image description here

UPDATED:

I’m able to achieve the buttons with images horizontally (in two button in a row). My problem is, how can i tag it properly, so that i can action it properly.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {



UITableViewCell *cell=[[UITableViewCell alloc]init];
    static NSString *CellIdentifier1 = @"Cell";
    cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
//    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier1] autorelease];
    //}

tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
        cell.backgroundColor = [UIColor clearColor];

    UIButton *btn1 = [[UIButton alloc] initWithFrame:CGRectMake(11.0, 6.0, 80.0, 65.0)];
    //UIImageView *imageView = [UIImage imageNamed:@"avatar.png"];
    btn1.enabled = YES;
    // btn1.tag = ?????;   // HOW can it tag it properly.
    [btn1 setBackgroundImage:[UIImage imageNamed:@"image1.png"] forState:UIControlStateNormal];
    [btn1 addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
    [cell.contentView addSubview:btn1];


    UIButton *btn2 = [[UIButton alloc] initWithFrame:CGRectMake(180.0, 6.0, 80.0, 65.0)];        
    [btn2 addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
    // btn2.tag = ?????;   // HOW can it tag it properly as it is in horizontal position.
    [btn2 setImage:[UIImage imageNamed:@"image2.png"] forState:UIControlStateNormal];        
    [cell.contentView addSubview:btn2];

}

-(IBAction) buttonPressed: (id) sender
{
    UIButton *button = (UIButton *)sender;
    NSLog(@"Btn Tag: %d", [sender tag]);

}
  • 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-25T16:07:55+00:00Added an answer on May 25, 2026 at 4:07 pm

    NOW you have to do on this way at least you will know how much will be the button the work will be easy . in my code i assume that i have 100 buttons so firstly don’t use the static indentifier in table view cells use the code like this way .

    NSString *CellIdentifier = [NSString stringWithFormat:@”identifier_%d”, indexPath.row];
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    //if (cell == nil)
    if (cell == nil)
    {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ;

    // now i assume the button are 100 so i assing the indexrow to first button and indexrow+100 tag to another button and code is like this way the button will be global or local depends upon you

    and the function called by button on their clicking is as
    UIButton *Button = (UIButton *)sender; NSLog(@”Selected button tag is %d”, Button.tag);

    the tag which will print the value in 3 digit is a right hand button and other one is left handed but i assume only are 100 button are there so check out with your logic .

    Thanks,

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

Sidebar

Related Questions

I'm developing an iPhone application that have a TabBarController with two tabs. Each tab
I am developing an iPhone application in which I need to show an image
I am developing an iPhone application in which i need to connect with twitter.
I'm developing an iPhone OpenGL application, and I need to use some textures with
In an iPhone application I'm developing I need to get GPS coordinates to perform
I am developing an iPhone application which I need to distribute to an organization
I am developing a server backend for my iphone application. I need to upload
I am developing an application where I need to know some of my iphone
I need a file selector in an iPhone application I am developing to select
i am developing an application in iPhone, where i need to implement my 5

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.