facebookarchive / shimmer Goto Github PK
View Code? Open in Web Editor NEWAn easy way to add a simple, shimmering effect to any view in an iOS app.
License: Other
An easy way to add a simple, shimmering effect to any view in an iOS app.
License: Other
I'm trying to get Shimmer on a programmatically added button. It's a QBFlatButton, userStateButton = [[QBFlatButton alloc] initWithFrame:CGRectMake((cellView.frame.size.width - (80 + 20)), (self.screenHeight/(cellCount * 4)), 80, ((self.screenHeight + (cellCount * cellCount))/(cellCount * 2)))];
When I turn Shimmer on, the entire bounds that I've set for the button start shimmering (no surprise there, thats what I set the bounds as) so it looks like theres a rectangle around the logout button
FBShimmeringView *shimmeringView = [[FBShimmeringView alloc] initWithFrame:userStateButton.bounds];
How would I get just the text of the button to shimmer? I've already tried making the frame of the shimmeringView the frame of the titleLabel
(which it turns out is {{0, 0}, {0, 0}}
Any way to do this without adding it to the storyboard like issue #8
If I'm using Auto Layout on an FBShimmeringView
, it doesn't seem to work. It appears to work only when initialized with an explicit frame
.
This may be a non-issue and a necessary requirement of the library, but I'm just wondering if there are workarounds. I would like to center a shimmering view, and using rects isn't a great experience.
Thanks!
I see guys achieve this kind of effect. With a lot much less code.
I'm sorry~ i'm newbie, but just curious if this is possible?
warning info:
Assigning to 'id<CALayerDelegate> _Nullable' from incompatible type 'FBShimmeringLayer *const __strong'
- (void)_createMaskIfNeeded
{
if (_shimmering && !_maskLayer) {
_maskLayer = [FBShimmeringMaskLayer layer];
_maskLayer.delegate = self; // -> warning here ...
_contentLayer.mask = _maskLayer;
[self _updateMaskColors];
[self _updateMaskLayout];
}
}
I have tried many times ,but I can't see the shimmering effect when launch your project.
all the code is the same as when it was downloaded.
please give me a hand.
When compiling with -Wshadow, you get a warning
FBShimmeringView/FBShimmeringLayer.m:404:12: warning: declaration shadows a local variable [-Wshadow]
BOOL disableActions = [CATransaction disableActions];
^
FBShimmeringView/FBShimmeringLayer.m:360:8: note: previous declaration is here
BOOL disableActions = [CATransaction disableActions];
^
We'd love to see an update in this pod, any chances to make a swift 4 version?
The last tagged version is from Febr 2014 (1.0.2) while the last commit is from 12 days ago !
This gives the false first impression that the project is dead, while it isn't.
Unfortunately also, if you add pod 'Shimmer'
to your Podfile, CocoaPods will grab by default this 2014 version, which has bugs wrt Autolayout, Simulator and 64bits, that are now fixed in trunk.
Workaround: edit your Podfile like so: pod 'Shimmer', :git => 'https://github.com/facebook/Shimmer.git', :commit => '3589bd7ca0d122fe06792868485d79c622a3f47d'
Hey,
I've just released an Android version of that library. But reading your part regarding licensing and patents,
Shimmer is BSD-licensed. We also provide an additional patent grant.
I was wondering if there's any potential problem with me releasing the android version:
https://github.com/RomainPiel/Shimmer-android
Thanks!
When working with AutoLayout (programmatically), the FBShimmerView is not created with initWithFrame, but just by init. This gives a shimmering speed issue. (Shimmering is way to fast.)
I created a gist to demonstrate the issue: https://gist.github.com/MichMich/9535985
Hey there,
It seems like Shimmer doesn't work well with UIStackViews.
Here's what it's supposed to look like (this is without Shimmer added): https://abload.de/img/simulatorscreenshot15hokh1.png
Here's a screenshot of what happens when I add the Shimmer effect to the small grey view at the bottom: https://abload.de/img/simulatorscreenshot15x1kkz.png
The view hierarchy itself is very simple.
Cell View (grey coloured)
--UIStackView (white coloured)
----View (pink coloured)
----View (grey coloured)
I've got another similar view in my project which doesn't use a UIStackView and it works fine there (except from the fact that it's messed up when I rotate the device, but that's a different issue).
Android Native code is also available on GitHub
https://github.com/facebook/shimmer-android
The Java library has an option for angle, but not the iOS one. I'm not sure how to get started, anyone has an idea on what's required to support this?
Hello,
Thanks for the great source, it works like a charm.
Or I have a litte problem: this library support arc?
Jack
I created a UIView. Added it as contentView of the shimmerView.
shimmerView is constrained to my TableViewCell.contentView -- left, right, top, bottom.
The UIView is then constrained to shimmerView -- left, right, top, bottom.
[shimmerView setShimmering:YES]; then gives the error:
[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x170284150 V:|-(0)-[UIImageView:0x1008b6b90] (active, names: '|':UITableViewCellContentView:0x1008b1f10 )>",
"<NSLayoutConstraint:0x1702841f0 UIImageView:0x1008b6b90.height == 175 (active)>",
"<NSLayoutConstraint:0x170284380 V:[UIImageView:0x1008b6b90]-(0)-[FBShimmeringView:0x1008b4de0] (active)>",
"<NSLayoutConstraint:0x1702843d0 FBShimmeringView:0x1008b4de0.bottom == UITableViewCellContentView:0x1008b1f10.bottom (active)>",
"<NSLayoutConstraint:0x17409ab80 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x1008b1f10.height == 43.5 (active)>"
)
If I go to FBShimmeringLayer
layoutSubViews and comment out:
_contentLayer.anchorPoint = CGPointMake(0.5, 0.5);
_contentLayer.bounds = r;
_contentLayer.position = CGPointMake(CGRectGetMidX(r), CGRectGetMidY(r));
the errors go away but Shimmering no longer works.
When I try to compile Logo-iOS example project I see this error, what I'm doing wrong?
If you have multiple shimmering views, you may want their animations to be synchronized.
For example,
shimmeringView.delayTime = 3.0;
// Start shimmering in 3 seconds.
shimmeringView.shimmering = YES;
This is used in my own project~ 🍺
First, thanks for this Code. It's great and it really helped me.
Using Xcode 8, iOS 10 beta 2 and I started getting two warnings in FBShimmeringLayer.m
Line 287 and 400.
287: _maskLayer.delegate = self;
...
400: fadeInAnimation.delegate = self;
WARNING:
Assigning to 'id<CALayerDelegate> _Nullable' from incompatible type 'FBShimmeringLayer *const __strong'
Since I'm a SWIFT developer I'm not quite sure how to fix it myself. I thought I'd post here before trying to fix it incorrectly myself.
With the help of the engineers who wrote Google's EarlGrey testing framework, we found that including
[UIApplication sharedApplication].keyWindow.layer.speed = 100;
CAAnimations freeze and crash the app. The shimmering view freezes when it starts to shimmer, and isn't able to be dismissed.
Is there an way I can change the Shimmering direction.
Current default animation is from Left to Right.
What can I do to make it from Right to Left.
speed
Is there anyway I can specify if the shimmer happens from right to left or left to right?
Thanks!
i tester in ios6 shimmer not display label in example code.
seems that fadeOutWithCompletion block doesn't work, only fadeout without block.
Thanks.
There is functionality in the current master
branch not available in the latest CocoaPod, which was last updated December 2014. In the interest of saving other people headaches (too late to salvage mine), please keep the CocoaPod updated. Thanks!
All in the title (happened upon a build against the iOS 7.0 SDK in Xcode 5.0.2). Here's the affected code:
- (void)setShimmeringSpeed:(float)speed
{
if (speed != _shimmeringSpeed) {
_shimmeringSpeed = speed;
[self _updateShimmering];
}
}
I removed fadeLayer property of FBShimmeringMaskLayer, and commented out all the code related to this property. Everything still works fine. So my questions :
What abouta react-native package for Shimmer?
I would love to use the shimmeringDirection property but it is not included in the 1.0.1 Cocoapod release.
Can you tag a new release and update the podspec?
At the moment the shimmer takes the colour from the object its shimmering, it would be nice if you could specify a colour for the shimmer to be.
An example, a white label, could have a gold shimmer.
I hope that makes sense.
Thanks
Andrew.
Whether to support IB?
Implemented inside a collection view cell
cell.shimmerDataView.contentView = loadingView
Getting the following crash on 'Crashlytics'
0 CoreFoundation 0x27567e3f __exceptionPreprocess 1 libobjc.A.dylib 0x34c15c8b objc_exception_throw 2 CoreFoundation 0x2747cc49 -[__NSArrayM removeObjectAtIndex:] 3 UIKit 0x2ac95a97 _UIViewTopDownSubtreeTraversal 4 UIKit 0x2b02ea35 -[UIView(UIConstraintBasedLayout_EngineDelegate) _invalidateSystemLayoutSizeFittingSizeAtEngineDelegateLevel] 5 UIKit 0x2aac6175 -[UIView(AdditionalLayoutSupport) _setNeedsUpdateConstraintsNeedingLayout:] 6 UIKit 0x2b02d6c1 -[UIView(AdditionalLayoutSupport) _setSubviewWantsAutolayoutTripWantsAutolayout:] 7 UIKit 0x2aa0be23 -[UIView(Internal) _addSubview:positioned:relativeTo:] 8 UIKit 0x2aa0b8d3 -[UIView(Hierarchy) addSubview:] 9 Shimmer 0xda9c3b (Missing)
The CocoaPod doesn't appear to have the update that includes being able to set a FBShimmerDirection.
/Users/****/Downloads/Shimmer-master/Examples/Logo-iOS/ViewController.m:11:9: 'FBShimmering/FBShimmeringView.h' file not found
Like the title says, this is from a fresh build off master
Hey,
it is possible to set the Shimmer on a UIButton? I tried it already and it is not working. How can I modifier the lib for this feature?
ps: thanks for this awesome lib!!
FBShimmeringView *shimmeringView = [[FBShimmeringView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:shimmeringView];
shimmeringView.contentView = self.loginBt.titleLabel;
// Start shimmering.
shimmeringView.shimmering = YES;
I added the button via storyboard (weak, nonatomic)
Trying to get Shimmer to work in my Swift project using a bridging header. When I try to implement a FBShimmeringView object in my controller, the linker throws this error:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FBShimmeringView", referenced from:
type metadata accessor for __ObjC.FBShimmeringView in FeaturedViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Am I correct in assuming this framework is incompatible with the latest iPhone 64-bit processors, or am I missing something here?
i use it in ios5.1, and it words fine,and i havn't find any apis need ios6 or later.so who can tell me why
e.g. Shimmer from top-to-bottom, bottom-to-top, as well as right-to-left.
Ok, I’m surely missing something, but the fact that FBShimmeringLayer
can’t simply be used with +layerClass
and give whatever view the shimmering effect really bugs me.
Why is there the need for a contentLayer
to limit the effect? Shouldn’t be simply self.mask = _maskLayer
instead?
I tried this approach and worked perfectly…
(please keep in mind I just moved to Obj-C)
We're getting a crash when our UIViewController deallocated:
Thread 0 Crashed:
0 libobjc.A.dylib 0x000000018620af30 objc_msgSend + 16
1 UIKit 0x000000018d619c4c -[UIView(Hierarchy) setNeedsLayout] + 348
2 UIKit 0x000000018d8f429c __UIViewNoteTraitsDidChangeRecursively + 288
3 UIKit 0x000000018d8f43c0 __UIViewNoteTraitsDidChangeRecursively + 580
4 UIKit 0x000000018d8f43c0 __UIViewNoteTraitsDidChangeRecursively + 580
5 UIKit 0x000000018d8f43c0 __UIViewNoteTraitsDidChangeRecursively + 580
6 UIKit 0x000000018d96a690 -[UIViewController _updateTraitsIfNecessary] + 308
7 UIKit 0x000000018d6055cc -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 828
8 QuartzCore 0x000000018aace40c -[CALayer layoutSublayers] + 144
9 QuartzCore 0x000000018aac30e8 CA::Layer::layout_if_needed(CA::Transaction*) + 288
10 QuartzCore 0x000000018aace33c -[CALayer layoutIfNeeded] + 188
11 Shimmer 0x0000000102e67da8 0x102e60000 + 32168
12 Shimmer 0x0000000102e67430 0x102e60000 + 29744
13 Shimmer 0x0000000102e68ec0 0x102e60000 + 36544
Any ideas?
I wonder what happened with this repo?
I was going to use for my current app but it looks like it hasn't been update in a while.
I was see such code in FBShimmeringLayer.m
UIKIT_EXTERN float UIAnimationDragCoefficient(void);
I'm not so clear about the UIKIT_EXTERN.
please give your comments~thx!
In this Pod i can't make diagonal animation
help in updating the pod to the latest swift version i.e. 4.0
I created a view(shimmerView) and added a FBShimmerView onto it. Then I make my app do this loop:
Show the shimmerView, go to other views, go to shimmerView, go to other views...
Everything was normal except that something increased in the memory.
So I opened Instrument to see what happened. And it showed that instances of FBShimmeringLayer and FBShimmeringMaskLayer increased by one every tine a FBShimmerView is displayed. That means when a FBShimmerView is deallocated, the FBShimmeringLayer is persisted in the memory.
See the screenshot below:
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.