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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:36:59+00:00 2026-05-27T12:36:59+00:00

I have a Custom Section Header in UITableView , on that section header there

  • 0

I have a Custom Section Header in UITableView, on that section header there placed UIButton on its very right.What i want is, if i click on UIButton, that particular Section Header should scrolls to Top. That’s it

Any suggestion, piece of code will be admired.

  • 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-27T12:37:00+00:00Added an answer on May 27, 2026 at 12:37 pm

    Step 1: set the size of Section header. Example as follows.

    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
        return 55;
    }
    

    Step 2: create & return the customized section header.

    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
        UIView *aView =[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 55)];
        UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
        [btn setFrame:CGRectMake(0, 0, 320, 55)];
        [btn setTag:section+1];
        [aView addSubview:btn];
        [btn addTarget:self action:@selector(sectionTapped:) forControlEvents:UIControlEventTouchDown];
        return aView;
    }
    

    Step 3: return number of sections. ( for example 10 here )

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
    {
        return 10;
    }
    

    Step 4 : number of rows per section. ( for example, 4 rows for each section )

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        return 4;
    }
    

    Step 5 : create & return cell (UITableViewCell for each Row)

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"Cell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        }
        cell.textLabel.text=[NSString stringWithFormat:@"%i_%i",indexPath.section,indexPath.row];
    
        return cell;
    }
    

    Step 6: add the event to handle the TouchDown on section header.

    - (void)sectionTapped:(UIButton*)btn {
        [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:btn.tag-1] atScrollPosition:UITableViewScrollPositionTop animated:YES];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have a single custom section header, with the rest being the
I want to create a tableview like this. All sections have custom section header
I have a windows service that has a custom configuration section. In the configSectionHandler
I have custom classes that I currently instantiate within App.xaml as resources. I want
I have a custom UIView subclass that i'm trying to use as a header
I have a header section that's specified in html.tpl.php, but the header should be
UITableView has custom header UIView , which contains UILabel. Since table has also section
I have a tableview with custom section headers. The view for the section header
I have a UITableView with multiple sections. Each section has a section header (a
I have a custom configuration section and i want to generate an xsd scheme

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.