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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:20:39+00:00 2026-05-23T07:20:39+00:00

Scrollviewcustomcontrol not sending correct ID to display the desired output. We have two textviews

  • 0

Scrollviewcustomcontrol not sending correct ID to display the desired output. We have two textviews showing 4 articles snippets in scrollview. They are subviews of scrollview. Now clicking on them, I wish to open a details page of that article along with scroller so that all news could be browsed/scrolled in full form. ScrollerView is in place, working with paging, and showing all the records from beginning. Its just not going to the exact article that we clicked.
I tried to pass values via textviews and buttons assigned to it. But it can just pass two values since we have two textviews..and there are four articles..article number 3 is passing the ID of article number 1. And article number 4 is passing the ID of article number 2.
Any ideas?

    - (IBAction) tappedItemAtIndex:(id)sender {

UIButton *tappedButton = (UIButton*) sender;
NSInteger selectedIndex = [tappedButton tag];

}

    int j=0;
    for (int i = 0; i < rowOne.count; i++) {

        if (j==1) {

            j++;


        }

        count =i+1;
    CGRect frame;
    frame.origin.x = self.scrollView.frame.size.width * i;
    frame.origin.y = 0;
    frame.size = self.scrollView.frame.size;
    UIView*subView=[[UIView alloc ]initWithFrame:frame];
    [self.scrollView addSubview:subView];

    CGRect myframe=CGRectMake(107, 46, 258, 128);        

    //CGRect myframe=CGRectMake(13, 46, 352, 128);
    Book*book=[rowOne objectAtIndex:i];
    UIButton*backViewButton=[UIButton buttonWithType:UIButtonTypeCustom];

     backViewButton.frame=CGRectMake(107, 46, 258, 128);    
    [backViewButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];



        buttontitle=book.title;

        [backViewButton addTarget:self action:@selector(tappedItemAtIndex:)forControlEvents:UIControlEventTouchUpInside];    
        [backViewButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [backViewButton setTitle:buttontitle forState:UIControlStateNormal];
        [subView addSubview:backViewButton];


        backViewButton.tag=j;


        j++;

        Book*book1=[rowOneSecond objectAtIndex:i];
        UIButton*backViewButton1=[UIButton buttonWithType:UIButtonTypeCustom];

        backViewButton1.frame=CGRectMake(531, 99, 300, 100);    
        [backViewButton1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

        NSString*title=book1.title;

        backViewButton1.tag=j;

        [backViewButton1 addTarget:self action:@selector(tappedItemAtIndex:)forControlEvents:UIControlEventTouchUpInside];    
        [backViewButton1 setTitle:title forState:UIControlStateNormal];
        [subView addSubview:backViewButton1];                                               

} 
  • 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-23T07:20:39+00:00Added an answer on May 23, 2026 at 7:20 am

    Did you try setting tag to the textViews. Like when you add them in scrollview I assume you run a loop so add textView to a button and then add that button to scrollview and assign tag = index(loop increment variable). Add target to button. From there you can get the tag of button and then you pass it to super class by creating a delegate protocol.

    Update

    //I assume you have this type of function bound to each button’s touchUpInside.

    - (IBAction) tappedItemAtIndex:(id)sender {
        UIButton *tappedButton = (UIButton*) sender;
        NSInteger selectedIndex = [tappedButton tag];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.