1

I have a scroll view embedded inside of a uiviewcontroller that works 100% as expected until I open it as a modal view controller. Once that happens, the scroll size is about the size of the iOS Screen, but I'm definitely missing some stuff.Here is how I initialize my view controller in the appdelegate.

        UIWindow *window = [[UIApplication sharedApplication] keyWindow];
        UIViewController *currentController = window.rootViewController;
        while (currentController.presentedViewController)
            currentController = currentController.presentedViewController;

        UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
        UIViewController *newController = [storyBoard instantiateViewControllerWithIdentifier:@"Leads_Calls_SB"];

        [currentController presentViewController:newController animated:NO completion:nil];

        [[NSNotificationCenter defaultCenter] postNotificationName:@"callReceived"
                                                            object:nil
                                                          userInfo:userInfo];
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Chris Jenkins
  • 719
  • 7
  • 20
  • what ios version are you using? – Andrew Jul 08 '13 at 21:48
  • Have you seen this: http://stackoverflow.com/questions/10508524/how-to-embed-a-uitableview-in-a-uiscrollview – Andrew Jul 08 '13 at 21:51
  • Hmmm. I suppose I could do this, but it seems odd that this works perfectly until I try to present it from the appdelegate...any other ideas before I rip apart my viewcontroller and make it a tableview? :) Also, I don't think a tableview was meant to display the information like I'm displaying it. It should be a scrollview – Chris Jenkins Jul 08 '13 at 21:56
  • is there a way that you could test if the view is getting any touch input at all? Or is it just scrolling that isn't working. – Andrew Jul 08 '13 at 22:00
  • scrolling and touch input works, however the size is wrong. I declare the size in viewDidAppear, and I can breakpoint in there. I have no idea why it's not working or being overridden. – Chris Jenkins Jul 08 '13 at 22:02
  • i don't think its recommended to set the size in viewDidAppear. Try setting it in viewDidLoad or when you init the view controller. – Andrew Jul 08 '13 at 22:03
  • Why aren't you using storyboard segues to modally present your view controller? – Andrew Jul 08 '13 at 22:04
  • Because you can't have a segue from an appdelegate for push notifications. I segue to it from the storyboard for in the app, but from the app delegate that isn't possible. This should work. If you set the size in viewDidLoad, it won't work either. It has to be after load. – Chris Jenkins Jul 08 '13 at 22:06
  • You could use a .xib (interface builder) file to create the views interface which should get the size right – Andrew Jul 08 '13 at 22:09
  • After that I'm all out of ideas. +1 – Andrew Jul 08 '13 at 22:10
  • ah. Found the answer. Apple resizes a view when presenting a modal vc. I have to override it somewhere else...pain in the butt. Thanks for your help! – Chris Jenkins Jul 08 '13 at 22:11
  • It has been suggested that you answer your own question with what you found. – Andrew Jul 09 '13 at 01:48

0 Answers0