Comments (14)
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.
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.
Hi @dkcas11
Can you provide a demo project link which reproduces and demonstrates your issue?
Thanks.
from fspagerview.
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.
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.
@dkcas11 If you cannot find 0.2.0
in CocoaPods, probably you should try pod repo update
.
from fspagerview.
Yea, i forgot i had removed it again... D'oh.. :)
from fspagerview.
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.
Hi @dkcas11
- I don't quite understand what does this mean:
normal square cells are still behind my custom cell
- To keep the shadow, maybe you should try mask the
imageView
or thecontentView
of the cell instead.
from fspagerview.
@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.
@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.
@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.
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.
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)
- Changing alpha in subclass of FSPagerViewTransformer changes mode from ferrisWheel to linear HOT 1
- linear模式在最后一页删除最后一个元素时显示问题。
- losing focus on tvOS HOT 1
- [REQUEST]: Please create a new release with master's latest code. HOT 1
- How to looping through all the Cells in Swift?
- Can we provide pageCurl animation
- isScrollEnabled 属性不管用啊 我想让他停止滚动
- 会出现 Nan 问题
- FSPagerView
- xib报错 HOT 1
- pagerView.itemSize and pagerView.interitemSpacing not working
- automaticSlidingInterval
- 为什么在cellForItemAt方法里 打印index是 滚动两张图片直接执行两次啊?
- 偶尔会出现滚动一般卡住的情况 HOT 3
- last Image is not getting aligned in center of the view in some devices
- SDK does not contain 'libarclite' at the path '/Applications/Xcode-15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a HOT 2
- Warning once only: Detected a case where constraints ambiguously suggest a size of zero for a collection view cell's content view. We're considering the collapse unintentional and using standard size instead.
- selected state or highlighted state set failed
- selectItem error! HOT 1
- Assertion failure in -[AuraPura.CommunityPagerViewCell _preferredLayoutAttributesFittingAttributes:isAnimatingExistingView:], UICollectionViewCell.m:739
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fspagerview.