1

I tried to ask this a few days ago but found it hard to explain myself clearly so have opened this simpler question instead.

I have a View Controller A. I tap something to trigger a segue to View Controller B.

Is there any way of presenting B in a size smaller than the screen size such that A can still be seen and interacted with underneath?

Thanks.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
RobertyBob
  • 803
  • 1
  • 8
  • 20
  • Instead of presenting ViewController B, why don't you add a view with animation? You can add the View to Navigation Controller too, if you want to show the View on top of the Navigation Bar. – Chengappa C D Apr 20 '16 at 12:21
  • Thx Chandan - VC B is an already-established, incredibly complicated controller so would be good to just open it rather than incorporate it into A - it could be that what you've suggested is the same as Dheeraj below but it will take me a few mins to work that out as this is all a bit new for me. – RobertyBob Apr 20 '16 at 12:35

2 Answers2

1

The UIViewControllers have a property called

@property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyle NS_AVAILABLE_IOS(3_2);

You should try one of those. The default is full screen, but you have plenty of options there. Also, you have a custom one. You can set the property to custom and change the frame.

Hope it helps!!

facumenzella
  • 559
  • 3
  • 10
  • Many thanks - struggling to get the time to build a little test project for these suggestions but will get onto it as soon as I can. All the best. – RobertyBob Apr 25 '16 at 16:36
0

Display it in a view smaller than the actual viewcontroller (here it is baseView)

ViewControllerB * bvc = [self.storyboard instantiateViewControllerWithIdentifier:@"viewcontroller identifier"];
bvc.view.frame = self.baseView.bounds;
[self.baseView addSubview:bvc.view];
[self addChildViewController:bvc];
[bvc didMoveToParentViewController:self];
DHEERAJ
  • 1,478
  • 12
  • 32