EAIntroView icon indicating copy to clipboard operation
EAIntroView copied to clipboard

show Intro With Custom View From storyboard instead of Nib?

Open oenama opened this issue 9 years ago • 3 comments

is it possible to show Intro With Custom View From storyboard instead of Nib(xib file) ?

oenama avatar May 14 '16 06:05 oenama

It is not supported right now and not a short-term feature. But I am open to discussion and implementing it in future releases.

How do you want it to look? Storyboards can only store views inside ViewControllers. One possible idea is to make EAIntroView as some sort of container with pages as child views. http://stackoverflow.com/a/21946121/840588

ealeksandrov avatar May 19 '16 08:05 ealeksandrov

In theory, he could do it assigning an identifier to a view controller and then messaging the instantiateViewControllerWithIdentifier: method on a UIStoryboard instance. Something like:

#import "AppDelegate.h"
#import "EAIntroPage.h"

UIWindow *window = [(AppDelegate *)[[UIApplication sharedApplication] delegate] window];
UIStoryboard *storyboard = [[window rootViewController] storyboard];

UIViewController *newVC = [storyboard instantiateViewControllerWithIdentifier:@"SomeIdentifier"];
UIView *vcView = [newVC view];

EAIntroPage *page = [EAIntroPage pageWithCustomView:vcView];

I could be wrong, but I see no reason for this to fail.

alejandroivan avatar Aug 01 '16 16:08 alejandroivan

I confirm the above solution does work.

On the other hand, I currently have troubles with Auto Layout and Constraints for theses views within the storyboard. Starting them manually displays them fine (ex: by setting the view as initial view controller). When I load them trough EAIntroPage, sometimes, positions are ok, sometimes they are not and the behaviour changes each time I showInView (display the introduction view, without leaving the app).

I may send a PR with examples if I get something working out of it.

GabLeRoux avatar Aug 17 '17 14:08 GabLeRoux