GithubHelp home page GithubHelp logo

Comments (7)

dkcas11 avatar dkcas11 commented on July 29, 2024

Would it be possible to set the size, ie. change it, every time you create your cell?

from fspagerview.

st-small avatar st-small commented on July 29, 2024

@dkcas11 I recieve JSON, parse and have many items with photos, I want to show all of them in pageControl with animation (like a promo of goods). Photos have different sizes (also, landscape and portrait orientations). When I make collectionView, I put all photos in array with custom size (I calculated it from static height). Code is bellow. And make the cell of collectionView that size, that the photo has. I want to do the same with self.pageControl, is it really?

`- (UIImage*)resizingImage:(UIImage*)image {

CGFloat scaleFactor = targetHeight / image.size.height;
CGFloat targetWidth = image.size.width * scaleFactor;
CGSize targetSize = CGSizeMake(targetWidth, targetHeight);
UIImage* scaledImage = [SiSCollectionViewController imageWithImage:image scaledToSize:targetSize];

return scaledImage;

}

  • (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize {
    UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
    [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
    }`

from fspagerview.

st-small avatar st-small commented on July 29, 2024

I want to have pagerView size only for image (without white color by sides)
2017-02-22 21 29 16

from fspagerview.

dkcas11 avatar dkcas11 commented on July 29, 2024

Well one thing you could do, is scale all images to have the same width, but varying height. This way you ensure that the correct content is always displayed to the user.
I haven't tried it, but maybe you can use the itemSize in the cellForItemAt delegate function, before you return the cell, with its size applied to the pagerView.
Otherwise, you will have to subclass the FSPagerViewCell and make your own that supports this.

from fspagerview.

st-small avatar st-small commented on July 29, 2024

@dkcas11 Thank you very much for help but I can't understand what I should to do with itemSize. I set it property in cell making method and it show other photos incorrect. I add video to show how it works. May be I should to check if it current photo then change itemSize if no - reload itemSize (or use the default sizes)...

https://yadi.sk/i/82ZJbqRZ3ESpSz

from fspagerview.

dkcas11 avatar dkcas11 commented on July 29, 2024

I see.. I think you will have to subclass FSPagerViewCell and create the cell yourself, in order to support this.

from fspagerview.

st-small avatar st-small commented on July 29, 2024

@dkcas11 This is so hard to me, because I make the project with Objective-C language but the framework is on Swift written. It is so difficult level for me to make Objective-C class by subclass of swift. So I'll use it with aspectFill images. Looks so nice.

2017-02-24 19 24 52

from fspagerview.

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.