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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:33:23+00:00 2026-05-25T11:33:23+00:00

To begin with, I am new to the Objective C world, so my question

  • 0

To begin with, I am new to the Objective C world, so my question might sound naive. Even the structuring of methods might not be too proper, so kindly bear with me. I am sure I will learn as I move along.

I have a container view controller “DeckViewController” which houses another view controller “CardDetails“. CardDetails has a scroll view which is used to load 3 custom UIViews (CustomWebView) at a time, in which HTML is loaded. The HTML loaded in these views contains images and the requirement is that once the user clicks on any image in the page then it opens in a QLPreviewController. I have wrapped all the images in the HTML in an anchor tag to ensure that shouldStartLoadWithRequest delegate handles the loading of that image.

This handler is written in the class CustomWebView and I am trying to load the preview controller using CustomWebView’s parent view controller i.e. CardDetails.

I have traced the code and it is producing the right values but some how the modal view controller is not coming up at all. I might just be missing a small link or missing the whole point here. Would highly appreciate help and guidance.

Code snippet for the shouldStartLoadWithRequest delegate handler is given below-

- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
NSString* strExtension;
NSLog(@"THE Path of the image %@",request);
NSString *imageName = [[[request URL] path] lastPathComponent];
NSArray *comt = [imageName componentsSeparatedByString:@"."];
strExtension = [comt objectAtIndex:[comt count]-1];
NSLog(@"file extension %@",strExtension);
if ([strExtension isEqualToString:@"png"] || [strExtension isEqualToString:@"jpeg"] || [strExtension isEqualToString:@"jpg"]) {
    NSLog(@"######v %@",[[request URL] path]);
    QLPreviewController *previewController = [[QLPreviewController alloc] init];
    ImageViewController *imagecontrller = [[ImageViewController alloc] init];
    previewController.dataSource = imagecontrller;
    previewController.delegate = imagecontrller;
    [imagecontrller setImageURL:[request URL]];
    previewController.currentPreviewItemIndex = 0;
    [parentvc.navigationController presentModalViewController:previewController animated:YES];
    [previewController release];
    UIAlertView* alertView=[[UIAlertView alloc] initWithTitle:@"Alert" message:imageName delegate:self cancelButtonTitle:@"Close" otherButtonTitles:nil];
    [alertView show];
    [alertView release];
    //[imagecontrller release];


    return NO;
}else {
    return YES;
}

}

  • 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-25T11:33:24+00:00Added an answer on May 25, 2026 at 11:33 am

    Normally, if [UIViewController presentModalViewController:animated:] doesn’t work, it is because the existing view controller doesn’t have it’s parentViewController property set. Basically, it isn’t properly hooked into the view hierarchy. There are all sorts of reasons for this, but … that’s what you should look into.

    You need to either (a) find another view controller that does have a parentViewController and have that do the presentModal, or (b) carefully re-work your code so that each of the view controllers are aware of their parent, or …

    (c) The easy solution here is to keep a reference to your top-level view controller, and do the presentModal from there. When you’re ready to dismiss the modal view controller, it can actually call dismissModalViewControllerAnimated: on itself, and that will get forwarded to the view controller that presented it. Convenient.

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

Sidebar

Related Questions

To begin with, I'm not even sure, if it is the right way to
I'm new to the Win32 API and the many new types begin to confuse
I'm completely new to ANTLR and EBNF grammars to begin with, so this is
To begin with, the application in question is always going to be on the
I'm new to Objective-C and I'd like to abstract my database access using a
Recently I've begun to code in Objective-C for iOS 5 devices. My brand new
I have a question. I'm parsing content using Nokogiri and my objective is to
Hi I am using multiple begin forms. I am not sure if this is
all i want to do is end the current, and begin a new UL
I'm new to Objective-C, and I'm trying to create an app with two buttons

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.