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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:09:29+00:00 2026-06-04T13:09:29+00:00

I like the kindle for iPhone’s navigation – the one which enables you to

  • 0

I like the kindle for iPhone’s navigation – the one which enables you to just slide the titles in the navigation bar to move from one view to another. (I’m attaching the image)iPhone Kindle app screenshot

However, I was searching for a long time yesterday and I cannot find anybody who has done something similar.

Would you have any ideas on how to do this?

UPDATE: May 24, 2012

So now I have codes. Thanks to this tutorial http://bit.ly/xNOiqd. (I just copied most of his code.) But I still cannot achieve the same effect that the kindle app’s nav bar has. I can now peek on the left and the right item but my scroll view skips the labels which are on the odd indices of my array. Let’s say I have ‘Favourites’, ‘All Products’, and ‘Categories’. When I swipe left, I move from ‘Favourites’ to ‘Categories’ and skip ‘All Products’

Here’s the code.

#pragma mark -

- (void)loadVisiblePages {
    // First, determine which page is currently visible
    CGFloat pageWidth = self.scrollView.frame.size.width;
    NSInteger page = (NSInteger)floor((self.scrollView.contentOffset.x * 2.0f + pageWidth) / (pageWidth * 2.0f));

    // Update the page control
    self.pageControl.currentPage = page;

    // Work out which pages we want to load
    NSInteger firstPage = page - 1;
    NSInteger lastPage = page + 1;

    // Purge anything before the first page
    for (NSInteger i=0; i<firstPage; i++) {
        [self purgePage:i];
    }
    for (NSInteger i=firstPage; i<=lastPage; i++) {
        [self loadPage:i];
    }
    for (NSInteger i=lastPage+1; i<self.pageImages.count; i++) {
        [self purgePage:i];
    }
}

- (void)loadPage:(NSInteger)page {
    if (page < 0 || page >= self.pageImages.count) {
        // If it's outside the range of what we have to display, then do nothing
        return;
    }

    // Load an individual page, first seeing if we've already loaded it
    UIView *pageView = [self.pageViews objectAtIndex:page];
    if ((NSNull*)pageView == [NSNull null]) {
        CGRect frame = self.scrollView.bounds;

        //frame.origin.x = frame.size.width * page;
        frame.origin.x = (frame.size.width /2) * page;
        frame.origin.y = 0.0f;

        //
        frame = CGRectInset(frame, 10.0f, 0.0f);
        //self.scrollView.bounds = frame;

        /* == orig line
         UIImageView *newPageView = [[UIImageView alloc] initWithImage:[self.pageImages objectAtIndex:page]];
         newPageView.contentMode = UIViewContentModeScaleAspectFit;
         newPageView.frame = frame;
         */

        UILabel *newPageView = [[UILabel  alloc] init];
        newPageView.text = [self.pageImages objectAtIndex:page];
        newPageView.textColor = [UIColor whiteColor];
        //newPageView.textColor = [UIColor grayColor];
        newPageView.textAlignment = UITextAlignmentCenter;
        newPageView.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];
        [newPageView setBackgroundColor:[UIColor clearColor]];



        newPageView.frame = frame;

        [self.scrollView addSubview:newPageView];
        [self.pageViews replaceObjectAtIndex:page withObject:newPageView];
    }
}

- (void)purgePage:(NSInteger)page {
    if (page < 0 || page >= self.pageImages.count) {
        // If it's outside the range of what we have to display, then do nothing
        return;
    }

    // Remove a page from the scroll view and reset the container array
    UIView *pageView = [self.pageViews objectAtIndex:page];
    if ((NSNull*)pageView != [NSNull null]) {
        //[pageView removeFromSuperview];
        //[self.pageViews replaceObjectAtIndex:page withObject:[NSNull null]];
    }
}

- (void)viewDidLoad
{
    [super viewDidLoad];
//scroll view stuff
    self.scrollView.delegate = self;

    //attempt to make size of scrollview smaller
    //CGRect frame = self.scrollView.bounds;
    //frame = CGRectInset(frame, 10.0f, 0.0f);
    //CGFloat width = self.scrollView.frame.size.width/2.0f;

    self.pageImages = [NSArray arrayWithObjects:@"Favourites", @"All Products", @"Categories",@"Boo yah", nil];
    NSInteger pageCount = self.pageImages.count;

    // Set up the page control
    self.pageControl.currentPage = 0;
    self.pageControl.numberOfPages = pageCount;

    // Set up the array to hold the views for each page
    self.pageViews = [[NSMutableArray alloc] init];
    for (NSInteger i = 0; i < pageCount; ++i) {
        [self.pageViews addObject:[NSNull null]];
    }

}
- (void) viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
CGSize pagesScrollViewSize = self.scrollView.frame.size;
    //self.scrollView.contentSize = CGSizeMake(pagesScrollViewSize.width * self.pageImages.count, pagesScrollViewSize.height);

//This modifies the size of the scroll view, I can't seem to get it right
    self.scrollView.contentSize = CGSizeMake((pagesScrollViewSize.width / 1.50f )* self.pageImages.count, self.scrollView.frame.size.height);

    // Load the initial set of pages that are on screen
    [self loadVisiblePages];


}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    // Load the pages which are now on screen
    [self loadVisiblePages];
}
  • 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-04T13:09:31+00:00Added an answer on June 4, 2026 at 1:09 pm

    iCarousel is a nice open source project with lots of scroll types.

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

Sidebar

Related Questions

I would like to create web page which has to compatible on iPhone.. i
I am searching for open source free API just like Unity or SIO2 which
I'd like to create a kindle book based on some content I have, but
like this question , i have an NSView which is the contentView for an
I'd love like to read books properly on my Kindle. To achieve my dream,
I would like to know my iPhone places using Xcode like this app .I
Assuming I have an Amazon product URL like so http://www.amazon.com/Kindle-Wireless-Reading-Display-Generation/dp/B0015T963C/ref=amb_link_86123711_2?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-1&pf_rd_r=0AY9N5GXRYHCADJP5P0V&pf_rd_t=101&pf_rd_p=500528151&pf_rd_i=507846 How could I scrape
I am developing an app for tablets like samsung galaxy, moto xoom and kindle
I would like to write an app that can read DRMed Kindle books. Is
I would like to populate the list of mailboxes from Mail folder of Domino

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.