Giter Site home page Giter Site logo

Comments (11)

iDevelopper avatar iDevelopper commented on August 24, 2024

Not sure I understand the question. Can you upload her a sample?

from pbrevealviewcontroller.

abakhtin avatar abakhtin commented on August 24, 2024

I added example here https://github.com/abakhtin/pbrevealtest
I manually load view controller as main. If I use storyboard segues it works well. Can you help please? Am I misunderstood something about main view controller set method?
And the second question what is the difference between push and set segue?

from pbrevealviewcontroller.

iDevelopper avatar iDevelopper commented on August 24, 2024

All is in the title: "mainViewController is not aded to parentViewController at first call":

It is the case. You must either use the storyboard with "pb_left" and "pb_main" Set Segues or use the init method programmatically:

    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    
    UIViewController *leftController = [sb instantiateViewControllerWithIdentifier:@"LeftViewController"];
    UIViewController *mainController = [sb instantiateViewControllerWithIdentifier:@"MainViewController"];
    
    PBRevealViewController *revealController = [[PBRevealViewController alloc]initWithLeftViewController:leftController mainViewController:mainController rightViewController:nil];
        
    self.window.rootViewController = revealController;

In a storyboard, the PBRevealViewControllerSegueSetController segue is for setting a controller (the equivalent of the root view controller segue for a navigation controller for example). The PBRevealViewControllerSeguePushController segue is for pushing a controller (the equivalent of the Show segue for a navigation controller).

from pbrevealviewcontroller.

abakhtin avatar abakhtin commented on August 24, 2024

Clear.
The problem is that I want to load reveal from storyboard but set up main in code based on the flow.
Why you need this crazy workaround with checking for existing controller:
if (_mainViewController && animated) {
[self _swapFromViewController:_mainViewController toViewController:mainViewController operation:PBRevealControllerOperationReplaceMainController animated:animated];
}
Can it be improved? Or should I create revealVC in code? :)

from pbrevealviewcontroller.

iDevelopper avatar iDevelopper commented on August 24, 2024

What is the reason you want to do that?

from pbrevealviewcontroller.

abakhtin avatar abakhtin commented on August 24, 2024

I have different controllers that can be used as main at application start based on the business logic. But left controller is always the same and I want them to be together in single storyboard.
That it is a very rare case, but I think you can add assert about it so developers can understand why it is not working.

from pbrevealviewcontroller.

iDevelopper avatar iDevelopper commented on August 24, 2024

Ok try with this version. I will update the Swift version too and push a commit but not today...

pbrevealtest-master.zip

from pbrevealviewcontroller.

abakhtin avatar abakhtin commented on August 24, 2024

great thanks i ll check when it will be available in the repo.

from pbrevealviewcontroller.

iDevelopper avatar iDevelopper commented on August 24, 2024

Done! Github repo here and Cocoapods here. On Cocoapods there may be a delay.

from pbrevealviewcontroller.

Oleygen avatar Oleygen commented on August 24, 2024

When working with pure programmatically UI:
Still having issue with this. All flow just breaks if setMainViewController function is called before PBReaviewViewController.loadView() method.

from pbrevealviewcontroller.

iDevelopper avatar iDevelopper commented on August 24, 2024

You have to create PBRevealViewController object first.

from pbrevealviewcontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.