https://github.com/facebook/Shimmer
6000 + star
乍得一看好高大上看不懂,仔细一看还不如乍得一看。
Quartzcore - 还需要继续研究研究。任重道远。
下面抄代码了,唉
拿来用用。
FBShimmeringView *shimmeringView = [[FBShimmeringView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:shimmeringView];
shimmeringView.backgroundColor = [UIColor blackColor];
UILabel *loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 100, CGRectGetWidth(self.view.bounds) - 40, 44)];
loadingLabel.textAlignment = NSTextAlignmentCenter;
loadingLabel.text = @"这尼玛效果拔群,脸书出品,必出精品";
loadingLabel.textColor = [UIColor whiteColor];
loadingLabel.font = [UIFont systemFontOfSize:16];
// 直接赋值,设置的frame就 无效了
shimmeringView.contentView = loadingLabel;
// 添加子视图,同样有效果
UIView *vvv = [[UIView alloc] initWithFrame:CGRectMake(100, 200, 100, 100)];
vvv.backgroundColor = [UIColor whiteColor];
[shimmeringView.contentView addSubview:vvv];
// 闪亮!!!
shimmeringView.shimmering = YES;