Closed fulldecent closed 6 years ago
Have you tried using bgImage
instead of titleIconView
?
Also I have no idea what is happening on your attached screen and how do you want it to look.
I have tried bgImage too and got the same effect.
I was hoping for it to shrink to fit on the screen like in this screenshot.
What happens if you drop your image in example project?
I don't understand yet where is titleIcon
on your screenshot.
Sorry. In my screenshot, the intro screen is the two blue guys. Here is what I have so far with KXIntroView (https://github.com/kolyvan/kxintro).
I am seeking to approximate this experience using EAIntroView.
Ok, now I see. Can you share this image with me, so I can test it?
You bet. Thanks for your help!
Here is how you can do it now:
EAIntroPage *page1 = [EAIntroPage page];
page1.title = @"Testing image";
page1.desc = sampleDescription1;
page1.bgImage = [UIImage imageNamed:@"bg1"];
UIImage *testImage = [UIImage imageNamed:@"image"];
UIImageView *testImageView = [[UIImageView alloc] initWithImage:testImage];
float imageRatio = testImage.size.width / testImage.size.height;
float widthToFit = self.view.bounds.size.width;
[testImageView setFrame:CGRectMake(0, 0, widthToFit, widthToFit / imageRatio)];
page1.titleIconView = testImageView;
In EAIntroView we're preserving original image size 1:1. Code above will resize titleIconView
to fit screen.
I will think more about updating page layout to handle this automatically.
Very nice, thank you!
In portrait orientation this will work. I'll need to figure it out when rotating or switching to other devices.
I'll look into it on weekend and give you update.
Added autolayout constraints to fit titleIconView inside page frame - https://github.com/ealeksandrov/EAIntroView/commit/a090a152d01e8259391432de867ba5c7b4aec7c7
With your image it produces same screenshot as workaround above. Also works in landscape.
It lays out titleIconView - title - description
vertically. PageControl and SkipButton may overlap - but they can be on any position on a page (for example, on top), so I don't manage them in this equation.
To add padding between description and screen bottom and fit pageControl there - you can add empty newlines at the end of page description.
Released in 2.11.0.
Thank you, this works great now!
I was expecting the image to take up the available space. This is the code we used:
This is what we got
Currently best practice is this implementation: https://github.com/kolyvan/kxintro