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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:22:00+00:00 2026-05-26T07:22:00+00:00

I have a small application with some detail controller. Detail controller is a web

  • 0

I have a small application with some detail controller. Detail controller is a web view put inside scroll view:
Here is a code of detail view controller:

- (void)loadScrollViewWithPage:(int)page

{

if (page < 0)
    return;
if (page >= detailTotalJobs)
    return;

// replace the placeholder if necessary
SearchJobDetailWebViewController *controller = [viewControllers objectAtIndex:page];
if ((NSNull *)controller == [NSNull null])
{



    NSLog(@"Vytvaram web controller: %d", page + 1);

    if (detailJobIndex == page) {

        controller = [[SearchJobDetailWebViewController alloc] initWithNibName:@"SearchJobDetailWebViewController" bundle:nil page:page url:detailExportUrl];
        [viewControllers replaceObjectAtIndex:page withObject:controller];
        [controller release];

    } else if (detailJobIndex + 1 == page) {

        controller = [[SearchJobDetailWebViewController alloc] initWithNibName:@"SearchJobDetailWebViewController" bundle:nil page:page url:detailNextExportUrl];
        [viewControllers replaceObjectAtIndex:page withObject:controller];
        [controller release];

    } else {

        [self performSelector:@selector(downloadData:) withObject:[NSNumber numberWithInt:page] afterDelay:0.1];
        //[self downloadData:[NSNumber numberWithInt:page]];

        controller = [[SearchJobDetailWebViewController alloc] initWithNibName:@"SearchJobDetailWebViewController" bundle:nil page:page url:nextArray.exportUrl];
        [viewControllers replaceObjectAtIndex:page withObject:controller];
        [controller release];

    }

}

// add the controller's view to the scroll view
if (controller.view.superview == nil)
{

    CGRect frame = scrollView.frame;
    frame.origin.x = frame.size.width * page;
    frame.origin.y = 0;
    controller.view.frame = frame;
    [scrollView addSubview:controller.view];

    //NSDictionary *numberItem = [self.contentList objectAtIndex:page];
    //controller.numberImage.image = [UIImage imageNamed:[numberItem valueForKey:ImageKey]];
    //controller.myLabel.text = @"Test";
}

}

- (void)scrollViewDidScroll:(UIScrollView *)sender

{
// We don’t want a “feedback loop” between the UIPageControl and the scroll delegate in
// which a scroll event generated from the user hitting the page control triggers updates from
// the delegate method. We use a boolean to disable the delegate logic when the page control is used.
if (pageControlUsed)
{
// do nothing – the scroll was initiated from the page control, not the user dragging
return;
}

// Switch the indicator when more than 50% of the previous/next page is visible
CGFloat pageWidth = scrollView.frame.size.width;
int page = floor((scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
pageControl.currentPage = page;

NSString *detailTitleText = [NSString stringWithFormat:@"%d / %d", page + 1, detailTotalJobs];
[self setTitle:detailTitleText];
//[detailTitleText release];

// load the visible page and the page on either side of it (to avoid flashes when the user starts scrolling)
[self loadScrollViewWithPage:page - 1];
[self loadScrollViewWithPage:page];
[self loadScrollViewWithPage:page + 1];

// A possible optimization would be to unload the views+controllers which are no longer visible

}

Code inspired by Apple page control.

Problem is here:

if (detailJobIndex == page) {

        controller = [[SearchJobDetailWebViewController alloc] initWithNibName:@"SearchJobDetailWebViewController" bundle:nil page:page url:detailExportUrl];
        [viewControllers replaceObjectAtIndex:page withObject:controller];
        [controller release];

    } else if (detailJobIndex + 1 == page) {

        controller = [[SearchJobDetailWebViewController alloc] initWithNibName:@"SearchJobDetailWebViewController" bundle:nil page:page url:detailNextExportUrl];
        [viewControllers replaceObjectAtIndex:page withObject:controller];
        [controller release];

    } else {

        [self performSelector:@selector(downloadData:) withObject:[NSNumber numberWithInt:page] afterDelay:0.1];
        //[self downloadData:[NSNumber numberWithInt:page]];

        controller = [[SearchJobDetailWebViewController alloc] initWithNibName:@"SearchJobDetailWebViewController" bundle:nil page:page url:nextArray.exportUrl];
        [viewControllers replaceObjectAtIndex:page withObject:controller];
        [controller release];

    }

First part and second part of if work correctly, because I have data for first web view and for second web view.

But last part of if have a problem. when I scroll from second web view to third web view, scroll view show blank page. Next pages work correctly.
Where is problem, please ?

  • 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-26T07:22:00+00:00Added an answer on May 26, 2026 at 7:22 am

    Just put a breakpoint in debug mode on the braces.
    Is controller nil ?
    Check your custom init method.

    Does it return nil if there is a problem ?

    [self = super initWithNibName..................];
    if (!self) return nil;
    
    // some inits
    
    return self;
    

    If this is done and controller is nil, check your URL, and try it into a web browser. Does it showsup ?

    How do you fill your webView ? Is there an error returned when filling it ? No encoding problem returned ?

    Well, some code would help, but these indications are the most common problems you can have.

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

Sidebar

Related Questions

I have small application, and I will have some external applications put data to
I am working on a small AIR desktop application and I have some configuration
I have a small application where there are some reports i have done. What
I have a small JSF application where the user is required to enter some
I have a small Java application which uses some configuration settings, which are saved
I am writing a small application in c++ and I have some questions regarding
I have a small web application in asp.net and I'm using SQL Server. How
I have a small software application where i have some plugins in the form
I have a small web application that has multi-language support (en, de, it, fr,
I have a small WPF application that writes some basic information to the registry

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.