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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:56:50+00:00 2026-06-03T14:56:50+00:00

I am new to trying to create a book app adapting the page-based application

  • 0

I am new to trying to create a book app adapting the page-based application of the new xcode just using the single view app, because it is quite confusing learning the template.

i found this code and i am trying to replace the HTML content of this work to UIImageView but i failed.

- (void) createContentPages
{
    NSMutableArray *pageStrings = [[NSMutableArray alloc] init];
    for (int i = 1; i < 11; i++)
    {
        NSString *contentString = [[NSString alloc]
                                   initWithFormat:@"<html><head></head><body><h1>Chapter %d</h1><p>This is the page %d of content displayed using UIPageViewController in iOS 5.</p></body></html>", i, i];
        [pageStrings addObject:contentString];
    }
    pageContent = [[NSArray alloc] initWithArray:pageStrings];
}

what i am trying to is to display different images per page.

here is what i did. (i know it is so wrong i just tried it)

- (void) createContentPages
{
    NSMutableArray *pageStrings = [[NSMutableArray alloc] init];
    for (int i = 1; i < 11; i++)
    {
        NSArray *photos = [[NSArray arrayWithObjects:   
                        [UIImage imageNamed:@"p1.png"],
                        [UIImage imageNamed:@"p2.png"],
                        [UIImage imageNamed:@"p3.png"],
                        [UIImage imageNamed:@"p4.png"],
                        nil];
        [pageStrings addObject:photos];
    }
    pageContent = [[NSArray alloc] initWithArray:pageStrings];
}

and it has UIWebView in each page. is it possible that if i replace it with UIImageView it will run?

Here’s the rest of the code:

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self createContentPages];
    NSDictionary *options = 
    [NSDictionary dictionaryWithObject:
     [NSNumber numberWithInteger:UIPageViewControllerSpineLocationMin]
                                forKey: UIPageViewControllerOptionSpineLocationKey];

    self.pageController = [[UIPageViewController alloc] 
                           initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl
                           navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal
                           options: options];

    pageController.dataSource = self;
    [[pageController view] setFrame:[[self view] bounds]];

    contentViewController *initialViewController = 
    [self viewControllerAtIndex:0];
    NSArray *viewControllers =  
    [NSArray arrayWithObject:initialViewController];

    [pageController setViewControllers:viewControllers  
                             direction:UIPageViewControllerNavigationDirectionForward 
                              animated:NO 
                            completion:nil];

    [self addChildViewController:pageController];
    [[self view] addSubview:[pageController view]];
    [pageController didMoveToParentViewController:self];
}

- (contentViewController *)viewControllerAtIndex:(NSUInteger)index
{
    // Return the data view controller for the given index.
    if (([self.pageContent count] == 0) || 
        (index >= [self.pageContent count])) {
        return nil;
    }

    // Create a new view controller and pass suitable data.
    contentViewController *dataViewController = 
    [[contentViewController alloc]
     initWithNibName:@"contentViewController" 
     bundle:nil];
    dataViewController.dataObject = 
    [self.pageContent objectAtIndex:index];
    return dataViewController;
}

- (NSUInteger)indexOfViewController:(contentViewController *)viewController
{
    return [self.pageContent indexOfObject:viewController.dataObject];
}

- (UIViewController *)pageViewController:
(UIPageViewController *)pageViewController viewControllerBeforeViewController:
(UIViewController *)viewController
{
    NSUInteger index = [self indexOfViewController:
                        (contentViewController *)viewController];
    if ((index == 0) || (index == NSNotFound)) {
        return nil;
    }

    index--;
    return [self viewControllerAtIndex:index];
}

- (UIViewController *)pageViewController:
(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
{
    NSUInteger index = [self indexOfViewController:
                        (contentViewController *)viewController];
    if (index == NSNotFound) {
        return nil;
    }

    index++;
    if (index == [self.pageContent count]) {
        return nil;
    }
    return [self viewControllerAtIndex:index];
}

on subclass

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [webView loadHTMLString:dataObject 
                    baseURL:[NSURL URLWithString:@""]];
}
  • 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-03T14:56:51+00:00Added an answer on June 3, 2026 at 2:56 pm

    All time you may use the pictures inside HTML page using the HTML tag <IMG>. So, no the reason to use UIImageView.

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

Sidebar

Related Questions

I am trying to create a new dict using a list of values of
I am trying to create a new branch using the API, and have used
I want to create a 'detail view' in my navigation-based app similar to the
I am trying to create a simple application using SpringMVC for learning purpose. I
I'm new to Drupal and trying to create a book to be used for
I am trying to create a metro app based on a Developing windows 8
I'm trying to create a create model object page. I'm using asp.net mvc with
When trying to create a new team project with any of the default project
I'm trying to create a new object of type T via its constructor when
I'm trying to create a new project in NetBeans PHP from existing sources. When

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.