Git Product home page Git Product logo

Comments (14)

WenchaoD avatar WenchaoD commented on May 8, 2024 3

Hey guys. The function registerNib has been added. Please notice that the object in your nib file must be UICollectionViewCell object rather than UIView. Then you need to change the custom class to the class name of the FSPagerViewCell subclass.

from fspagerview.

Saleh-At avatar Saleh-At commented on May 8, 2024 1

Like This:
@IBOutlet weak var pagerView: FSPagerView! { didSet { let nib = UINib(nibName: "CustomCell", bundle: nil) self.pagerView.register(nib,forCellWithReuseIdentifier: "myID") } }

override func viewDidLoad() {
    super.viewDidLoad()
    pagerView.transformer = FSPagerViewTransformer(type: .linear)       
    
}

var names = ["File1","File26","File3","File7","File8","File9","File10"]

public func numberOfItems(in pagerView: FSPagerView) -> Int {
    return 5
}

public func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell {
    let cell = pagerView.dequeueReusableCell(withReuseIdentifier: "myID", at: index) as! CustomCell
    cell.btn.setImage(UIImage(named: names[index]), for: .normal)
    cell.btn.setTitle(names[index], for: .normal)
    cell.lbl.text = names[index]
    return cell
}`

from fspagerview.

WenchaoD avatar WenchaoD commented on May 8, 2024

Hi @dkcas11
Can you provide a demo project link which reproduces and demonstrates your issue?

Thanks.

from fspagerview.

dkcas11 avatar dkcas11 commented on May 8, 2024

Hey @WenchaoD

I basically just copy/pasted your code in, from the README and use the frame from my existing UICollectionView (which i then set isHidden = true) and the same frame for pageControl too.

The cell is here https://www.dropbox.com/s/9hp7kw9s5hl0lrw/Custom%20Cell.zip?dl=1
(Without subclassing FSPagerViewCell, i reverted it to continue working :))

from fspagerview.

thenopen avatar thenopen commented on May 8, 2024

I have the same problem. I hope it will be handled quickly.

self.pagerView.registerNib(UINib(nibName: "CustomPagerViewCell", bundle: nil), forCellWithReuseIdentifier: "cell")

Value of type 'FSPagerView' has no member 'registerNib'"

I wish that I wanted to implement it through NIB.
But I received the message above.

from fspagerview.

WenchaoD avatar WenchaoD commented on May 8, 2024

@dkcas11 If you cannot find 0.2.0 in CocoaPods, probably you should try pod repo update.

| screen shot 2017-02-22 at 8 06 37 pm
|
|--- |

from fspagerview.

dkcas11 avatar dkcas11 commented on May 8, 2024

Yea, i forgot i had removed it again... D'oh.. :)

from fspagerview.

dkcas11 avatar dkcas11 commented on May 8, 2024

Okay, so right now it works, but it looks like the normal square cells are still behind my custom cell?
My custom cell have rounded corners and a subtle shadow. I can make the background disappear so i have the rounded corners again with masksToBounds, but then i lose the shadow. Is this a bug? Here are two screenshots.
Looks wrong: http://imgur.com/vW70PWT
Looks "right": http://imgur.com/BGkVhDu

Apart from this it really works smooth and well!

from fspagerview.

WenchaoD avatar WenchaoD commented on May 8, 2024

Hi @dkcas11

  1. I don't quite understand what does this mean: normal square cells are still behind my custom cell
  2. To keep the shadow, maybe you should try mask the imageView or the contentView of the cell instead.

from fspagerview.

dkcas11 avatar dkcas11 commented on May 8, 2024

@WenchaoD
What i meant was actually the contentView. I had yet to inspect the class, so i was unaware of that view. I set the background to clear and remove the shadow, so it all looks almost perfect :)
I still have the clipping at the top and at the bottom though. I tried to set PagerView's clipsToBounds to false, but that didn't do the trick, for some reason.
You can see what i mean here: http://i.imgur.com/OE1neKj.gif

from fspagerview.

WenchaoD avatar WenchaoD commented on May 8, 2024

@dkcas11
I've been confused about this problem too. This workaround works for me.

// Clear background colors in FSPagerViewCell subclass
self.contentView.backgroundColor = UIColor.clear
self.backgroundColor = UIColor.clear

from fspagerview.

dkcas11 avatar dkcas11 commented on May 8, 2024

@WenchaoD
I have already done that to the cell. The issue lies with the PagerView, since its that which clips the content. I tried to turn off clipsToBounds and also masksToBounds for both the PagerView and it's contenView, so far without luck.

pagerView.clipsToBounds = false
pagerView.layer.masksToBounds = false
pagerView.backgroundView?.clipsToBounds = false
pagerView.backgroundView?.layer.masksToBounds = false

I have really run out of ideas of where the issue is..

from fspagerview.

alcalyx avatar alcalyx commented on May 8, 2024

I have custom page cell, i added FSPageControll in my custom cell. But when i'm going to access to member of FSPageControll, the member is nil. I've created my custom XIB and put FSPageControll into that. But FSPageControl always nil. Why? Any Suggest?

from fspagerview.

sebanoidze avatar sebanoidze commented on May 8, 2024

I have custom page cell, i added FSPageControll in my custom cell. But when i'm going to access to member of FSPageControll, the member is nil. I've created my custom XIB and put FSPageControll into that. But FSPageControl always nil. Why? Any Suggest?

I had the same problem, this worked for me:

@IBOutlet weak var pagerView: FSPagerView! { didSet { let nib = UINib(nibName: "CustomPagerViewCell", bundle: nil) self.pagerView.register(nib, forCellWithReuseIdentifier: "CustomPagerViewCell") } }

and do not forget to set reuseIdentifier inside xib.

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.