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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:39:19+00:00 2026-06-05T18:39:19+00:00

I have a UITableView on a UIViewController. And this table has say 5 visible

  • 0

I have a UITableView on a UIViewController.
And this table has “say” 5 visible categories to choose from. But in the Array that holds the content i have “say” 10 categories. What i’ve created now is a normal scrolling table that goes from category 1 on index 0 to category 10 on index 9.
But what i’d rather have is category 1 also after category 10 and the other way around.

So basically an endless loop of a static Array.

I’ve tryed this with the scrollViewDidScroll: method, but when i do that it doesn’t scroll like you would expect a UITableView to scroll. It RACES to a random spot and moving 1 or two categories is impossible.

Here is a sample of my code. Hope somebody can help.

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (scrollView == categoryView){
        if (categoryView.contentOffset.y > 0.0) {
            loopcounter++;
            NSLog(@"ScrollView Scrolled DOWN");
            [categorytablecontent insertObject:[categorytablecontent objectAtIndex:0] atIndex:[categorytablecontent count]-1];
            [categorytablecontent removeObjectAtIndex:0];
            [categoryView reloadData];
        }
        if (categoryView.contentOffset.y < 0.0) {
            loopcounter = [categorytablecontent count];
            NSLog(@"ScrollView Scrolled UP");
            [categorytablecontent insertObject:[categorytablecontent objectAtIndex:[categorytablecontent count]-1] atIndex:0];
            [categorytablecontent removeObjectAtIndex:[categorytablecontent count]-1];
            [categoryView reloadData];
        }

        a = categoryView.visibleCells;

        for (UITableViewCell *cell in a){
            NSLog(@"Current Visible cell: %@", cell.textLabel.text);
        }
        NSLog(@"Current offset: %@", categoryView.contentOffset.y);
    }
}
  • 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-06-05T18:39:21+00:00Added an answer on June 5, 2026 at 6:39 pm

    There is more then one good way to do this. Does your controller implement the UITableViewDataSource Protocol? If so, the easiest thing would probably be to just return the modulo of your dataset size in cellForRowAtIndexPath.

    Something like:

    -(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];
        }
    
        // Use appropriate fields for your categorytablecontent object here...
        cell.textLabel.text = [categorytablecontent objectAtIndex:(indexPath.row % [categorytablecontent count])];
    
        return cell;
    }
    

    This should result in a nice smooth infinite scroll that loops through your static (or dynamic) content.

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

Sidebar

Related Questions

I have a UIViewController that contains a UITableView. I'm trying to fill this table
I have a UIPopOverController that shows a UIViewController with a UITableview in its view.
I have a problem with data in UITableView. I have UIViewController, that contains UITableView
So basically, how can I push a UIViewController from a UITableView. I have an
I have a UITableView , which I am controlling from a custom UIViewController .
First a little background info: I have UIViewController that contains a UITableView. In the
I have this code in my table view controller (and delegate): - (void)tableView:(UITableView *)tableView
I have a grouped UITableView in my UIViewController class and I'm finding that at
I have a UIviewController, in the xib file I added 3 uitableview cells, but
Here is the situation, I have UIViewController class with a UITableView outlet. I would

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.