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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:48:21+00:00 2026-06-17T13:48:21+00:00

I am using a webview in my contentviewcontroller , when I slide between pages

  • 0

I am using a webview in my contentviewcontroller, when I slide between pages my app crashes.
Below is my code:

contentviewcontroller.m

#import "ContentViewController.h"

@interface ContentViewController ()

@end

@implementation ContentViewController
@synthesize m_CtrlWebview,DocumentPath;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    m_CtrlWebview.scrollView.pagingEnabled=YES;
    m_CtrlWebview.scrollView.bounces=NO;
    m_CtrlWebview.scalesPageToFit=YES;
    m_CtrlWebview.backgroundColor=[UIColor clearColor];
    //m_CtrlWebview.scrollView.zooming=NO;
    m_CtrlWebview.scrollView.zoomScale=1.0;



    NSURL *url = [NSURL fileURLWithPath:DocumentPath isDirectory:NO];

    [m_CtrlWebview loadRequest:[NSURLRequest requestWithURL:url]];
}


-(void)dealloc
{
    [super dealloc];
}
- (void)viewDidUnload
{
    //[m_CtrlWebview stopLoading];
    [m_CtrlWebview release];
    [super viewDidUnload];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

In rootviewcontroller:

  #pragma mark - UIPageViewControllerDataSource Methods

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController
      viewControllerBeforeViewController:(UIViewController *)viewController
{
    NSUInteger currentIndex = [self.modelArray indexOfObject:[(ContentViewController *)viewController DocumentPath]];
    if(currentIndex == 0)
    {
        return nil;
    }

    ContentViewController *firstViewController = [self viewControllerAtIndex:currentIndex - 1];
    // ContentViewController *secondViewController = [self viewControllerAtIndex:x+1 ];


    return firstViewController;



}

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController
       viewControllerAfterViewController:(UIViewController *)viewController
{
    NSUInteger currentIndex = [self.modelArray indexOfObject:[(ContentViewController *)viewController DocumentPath]];
    if(currentIndex == self.modelArray.count-1)
    {
        return nil;
    }
    NSString *Path=[self.modelArray objectAtIndex:currentIndex + 1];
     if  (![[NSFileManager defaultManager] fileExistsAtPath:Path])
     {
        return nil; 
     }
    else
    {
        ContentViewController *firstViewController = [self viewControllerAtIndex:currentIndex + 1];

        return firstViewController;
    }

}

- (ContentViewController *)viewControllerAtIndex:(NSUInteger)index {

    if (([self.modelArray count] == 0) || (index >= [self.modelArray count])) {
        return nil;
    }
    ContentViewController *dataViewController;
    dataViewController = [[ContentViewController alloc]initWithNibName:@"ContentViewController" bundle:nil];

    dataViewController.DocumentPath = [self.modelArray objectAtIndex:index];
    return dataViewController;

}

How can I solve this issue? Also how to disable the zooming of the web view? Any help, Thanks in advance.

  • 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-17T13:48:23+00:00Added an answer on June 17, 2026 at 1:48 pm
    return [dataViewController autorelease];
    

    The above line in - (ContentViewController *)viewControllerAtIndex:(NSUInteger)index solved my issue.

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

Sidebar

Related Questions

I am loading url in android webview using below code webviewShowPost.loadUrl(URL); I want to
I am including HTML pages in an iPad magazine app using WebView (Woodwing Reader
I have an Android app using webview to load and display html pages. But
I am using webview in my android app to fetch some webpages from multiple
I load a web page by using WebView in my app and there are
The following view crashes the iPhone If I comment out the using (webView =
In my android app, I am playing a youtube video using WebView with IFrame
Would using webview with phonegap get an app rejected from Apple App Store? The
I have an app that sends user location data to the server using webview
In my code, I am properly using webview and handling onPageFinished and shouldOverrideUrlLoading events.

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.