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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:36:12+00:00 2026-05-23T23:36:12+00:00

Hey guys I’m trying to implement a scroll with page control, like the iPhone

  • 0

Hey guys I’m trying to implement a scroll with page control, like the iPhone home screen, but in a uitableview cell.

What I tried to do to attempt this is create a custom table view cell with a xib file, and placed the uipagecontrol and uiscrollview on it, and connected it with iboutlets to the uitableviewcell.

This is the code in the .h file for the custom cell.

@interface ScrollableCell : UITableViewCell <UIScrollViewDelegate>

@property (nonatomic, strong) IBOutlet UIScrollView *scrollView;
@property (nonatomic, strong) IBOutlet UIPageControl *pageControl;
@property (nonatomic, strong) NSMutableArray *viewControllers; 

This is the code from the .m file for the custom cell after synthesizing the properties.

- (CGSize)contentSizeForPagingScrollView {
CGRect bounds = self.scrollView.bounds;
return CGSizeMake(bounds.size.width * [self.viewControllers count] , bounds.size.height );
} 

@- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
    // Initialization code

    UIView *blueView = [[UIView alloc] initWithFrame:CGRectZero];
    [blueView setBackgroundColor:[UIColor blueColor]];

    UIView *redView = [[UIView alloc] initWithFrame:CGRectZero];
    [redView setBackgroundColor:[UIColor redColor]];

    UIView *yellowView = [[UIView alloc] initWithFrame:CGRectZero];
    [yellowView setBackgroundColor:[UIColor yellowColor]]; 

    self.viewControllers = [NSArray arrayWithObjects:blueView, redView, yellowView,nil];

    for (UIView *view in self.viewControllers) {
        [view setFrame:CGRectMake([self.viewControllers indexOfObject:view]*self.scrollView.frame.size.width+5, 
                                  5, 
                                  self.scrollView.frame.size.width-10, 
                                  self.scrollView.frame.size.height-10.0)];
        [self.scrollView addSubview:view];

    }

    self.pageControl.numberOfPages = [self.viewControllers count];
    self.pageControl.currentPage = 0;

    self.scrollView.pagingEnabled = YES;
    self.scrollView.backgroundColor = [UIColor blackColor];
    self.scrollView.showsVerticalScrollIndicator = NO;
    self.scrollView.showsHorizontalScrollIndicator = NO;
    self.scrollView.contentSize = [self contentSizeForPagingScrollView];
    self.scrollView.delegate = self;
    [self.contentView addSubview:self.scrollView];
    [self.contentView addSubview:self.pageControl];
}
return self;
}

-(void) scrollViewDidScroll:(UIScrollView *)scrollView
{
CGFloat pageWidth = scrollView.frame.size.width;
int page = floor((scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
self.pageControl.currentPage = page;
}

Hope you guys can help me get this working. If there is a different approach/ better approach that what I’m attempting, let me know.

For visual reference of what I’m trying to achieve, i think the pulse news app fits the bill

http://itunes.apple.com/us/app/pulse-news-for-iphone/id377594176?mt=8

its a table view, with horizontal scrolling on each cell.

Thanks.

  • 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-23T23:36:13+00:00Added an answer on May 23, 2026 at 11:36 pm

    If there is a different approach/ better approach that what I’m attempting, let me know.
    For visual reference of what I’m trying to achieve, i think the pulse news app fits the bill.

    If your main reference for designing this is the Pulse app, you should know that the developers actually did NOT resort to scrollviews. The Pulse app is all tableviews. One main vertical tableview and several horizontal “hacked” tableviews inside each cell that composes the vertical one.

    Its quite a smart implementation for a tableview. But who better to explain this to you than the developers of Pulse themselves; they were invited to a lecture at Stanford for their iOS programming course.
    Its on iTunes U and it’s at 6 min in the lecture called 10 Hacks to Go From Idea To #1 App. You should watch it and maybe rethink your app design if it suits you better.

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

Sidebar

Related Questions

Hey guys. I'm trying to configure TFS2010 on a home server. I want to
Hey guys I am trying to implement the twitter for posting the comments about
Hey guys, I don't know RegExp yet. I know a lil about it but
Hey guys, I'm trying to get my head around LINQ and FP, so forgive
Hey guys. I'm not much of a programmer, but still need to do some
Hey guys, I have a little button functionality that is not erring, but also
Hey guys. I am trying to get the selected option in an each loop.
hey guys, i'm getting an exception on the following inner exception: {Value cannot be
Hey guys i wrote a quick test. I want delete to call deleteMe which
Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my

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.