Skip to content
This repository has been archived by the owner on Sep 11, 2022. It is now read-only.

Updated to initialize with storyboard #147

Closed
wants to merge 3 commits into from
Closed

Updated to initialize with storyboard #147

wants to merge 3 commits into from

Conversation

filipemp
Copy link

@filipemp filipemp commented Jul 8, 2013

Hello, there's a problem with using storyboards and the pkrevealcontroller. I had a view controller with the pkrevealcontroller as a custom class and the initializer wasn't setting the self.controllerOptions. If you think this is ok or have any thoughts, feel free to contact me.

@msmollin
Copy link

msmollin commented Aug 8, 2013

This doesn't actually fix the issue in my environment. Looking over the code, you'd be better off moving your addition into the commonInitializer: selector, and then removing the if check in initWithFrontViewController:leftViewController:rightViewController:options:

I tested this fix with my code and it resolves the issue.

Code to reproduce (assumes you have a storyboard setup with a PKRevealController VC setup as the root):

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.revealController = (PKRevealController *)self.window.rootViewController;
    UIViewController *frontViewController = [[UIViewController alloc] initWithNibName:nil bundle:nil];
    UIViewController *leftViewController = [[UIViewController alloc] initWithNibName:nil bundle:nil];
    [self.revealController setFrontViewController:frontViewController];
    [self.revealController setLeftViewController:leftViewController];
    return YES;
}

@msmollin
Copy link

msmollin commented Aug 8, 2013

+1 although == nil is valid if you want to be explicit :) In places I worked before, we were pedantic enough to require constants on the left of the comparator, eg. if (nil != self) so as to avoid assignment issues.

@filipemp
Copy link
Author

filipemp commented Aug 8, 2013

I agree. Some things are better left explicit.

@pkluz
Copy link
Owner

pkluz commented Aug 8, 2013

I'm currently slightly too busy to look over most of the things people submitted but nevertheless I'd encourage you to check out the Development branch (Correction: RC Branch name is v2.0) where a 2.0 RC version of the controller is available. Would appreciate it if you could tell me whether it also solves your problems with storyboards.

On Aug 8, 2013, at 4:58 PM, Filipe Marques [email protected] wrote:

I agree. Some things are better left explicit.


Reply to this email directly or view it on GitHub.

@filipemp
Copy link
Author

filipemp commented Aug 8, 2013

I see that this branch is not working with cocoapods right now. I'll test this as soon as possible but it may take some time.

@msmollin
Copy link

msmollin commented Aug 9, 2013

@pkluz I pulled in v2.0 and it appears to work without issue. I also updated the podspec so I could utilize cocoapods to test it.

PR is here:
#152

The way I tested it was to update my local spec to look like this:

pod 'PKRevealController', :path => '~/Coding/git_projects/PKRevealController/PKRevealController.podspec'

Obviously your path will be different.

@msmollin
Copy link

msmollin commented Aug 9, 2013

Even easier way to test:

pod 'PKRevealController', :git => 'https://github.com/pkluz/PKRevealController.git', :branch => 'v2.0'

EDIT the above depends upon my linked PR being merged :)

@awebermatt
Copy link

Ok so after additional testing, v2.0 branch has got some additional issues that need to be mended before it can actually be used with storyboards. I'll try to figure out a good regression, and open a separate issue / PR.

@awebermatt
Copy link

@filipemp You know I just took a look at master, and your fix is "in" master. Just the cocoapod tag is earlier than the hash on master.

Change your podfile to be
pod 'PKRevealController', :git => 'https://github.com/pkluz/PKRevealController.git', :branch => 'master'

@filipemp
Copy link
Author

filipemp commented Aug 9, 2013

@awebermatt are you sure? i looked at pkluz master and it doesn't look like it is.

@awebermatt
Copy link

@filipemp Yeah take a look at commonInitializer in master:

- (void)commonInitializer
{
    _controllerOptions = [NSMutableDictionary dictionaryWithCapacity:10];
    _frontViewController.revealController = self;
    _leftViewController.revealController = self;
    _rightViewController.revealController = self;
}

It's a little more heavy-handed than your approach, as in the standard initializer _controllerOptions gets over-written.

@filipemp
Copy link
Author

@awebermatt oh, yeah, now i see it.

@filipemp filipemp closed this May 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants