bfeher / bfpapertableviewcell Goto Github PK
View Code? Open in Web Editor NEWA subclass of UITableViewCell for iOS inspired by Google's Paper Material Design.
License: MIT License
A subclass of UITableViewCell for iOS inspired by Google's Paper Material Design.
License: MIT License
*** Terminating app due to uncaught exception 'NSRangeException', reason:
'*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
happens only in version 1.3.0
I think with your last update you forgot to remove or comment out a NSLog statement. I get this frequently in my log:
tapCircleDiameterStartValue = '375.00'
I have set letBackgroundLinger to NO, but when my finger left, the background Color remains.
As an enhancement, is it possible to have the ripple effect move with your finger like in this picture (see yellow button, from https://github.com/balysv/material-ripple)? In BFPaperTableViewCell it's kind of static.
I was using v1.3.1 in my custom table view cell without any problem like this:
self.usesSmartColor = false
self.tapCircleColor = UIColor(netHex: 0xff95bc)
self.backgroundFadeColor = UIColor(netHex: 0xff95bc)
self.letBackgroundLinger = true
Now I upgraded to 2.1.17 and there is a problem. When you tap on a cell it animates like expected, then the circle disappears. Instead the cell's background color is now completely covered by tapCircleColor.
Just as a tip, to help trace down such problems it is good practice to maintain a CHANGELOG.md and list changes as well as breaking changes in your code.
Have 2 warnings:
Warning:(396, 39) assigning to 'id<CAAnimationDelegate> _Nullable' from incompatible type 'BFPaperTableViewCell *const __strong'
It seems that BFPaperTableViewCell () is missing conform to CAAnimationDelegate, so it might be pretty straightforward fix.
PS: in BFPaperCheckbox it seems to be already fixed
@bfeher hello again :)
I have a problem drawing a bottom border in my subclassed BFPaperTableViewCell:
override func drawRect(rect: CGRect) {
if self.drawBorder {
var context = UIGraphicsGetCurrentContext()
CGContextMoveToPoint(context, CGRectGetMinX(rect), CGRectGetMaxY(rect))
CGContextAddLineToPoint(context, CGRectGetMaxX(rect), CGRectGetMaxY(rect))
CGContextSetStrokeColorWithColor(context, UIColor(netHex: 0xEFEEF4).CGColor)
CGContextSetLineWidth(context, 2)
CGContextStrokePath(context)
}
}
this works. But as soon as I touch the cell the border disappears. Do you have any idea how to fix this?
I have subclassed BFPaperTableViewCell and applied rounded corners in drawRect:
UIBezierPath(roundedRect: rect, byRoundingCorners: UIRectCorner.AllCorners, cornerRadii: CGSizeMake(2, 2)).fill()
The problem is that the ripple effect fills the entire cell and removes the rounded corners. Any idea how to solve this? @bfeher
Using UITableViewCell
you get this effect when you first click on a cell, segue to another view and move back again. The cell is still selected and the selection state fades out animated. You can see it in the iPhone Settings app very clearly.
I noticed that BFPaperTableViewCell
is not behaving that way. Are there plans to implement that?
I've implemented a fix myself, and it looks a lot better! It can be easily accomplished by adding a void
block property to the class and queuing the removeBackground
and removeCircle
animations to be called in animationDidStop:
:
@property (nonatomic, copy) void (^removalAnimationsQueue)();
...
if (self.removalAnimationsQueue) {
self.removalAnimationsQueue()
self.removalAnimationsQueue = nil;
}
For example, in setSelected:animated:
, the if (!selected)
statement can be modified like so:
if (!selected) {
if (!self.growthFinished) {
// Not done yet, queue removeBackground call
void (^oldBlock)() = self.removalAnimationsQueue;
__weak typeof(self) weakSelf = self;
self.removalAnimationsQueue = ^void() {
if (oldBlock)
oldBlock();
[weakSelf removeBackground];
};
}
else {
[self removeBackground];
}
}
And in touchesEnded:withEvent:
...
if (self.growthFinished) {
[self removeCircle];
}
else {
// Not done yet, queue removeCircle call
__weak typeof(self) weakSelf = self;
void (^oldBlock)() = self.removalAnimationsQueue;
self.removalAnimationsQueue = ^void() {
if (oldBlock)
oldBlock();
[weakSelf removeBackground];
};
}
And that should do it. :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.