Skip to content

Instantly share code, notes, and snippets.

@MichMich
Created March 13, 2014 20:12
Show Gist options
  • Save MichMich/9535985 to your computer and use it in GitHub Desktop.
Save MichMich/9535985 to your computer and use it in GitHub Desktop.
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor];
//The following line creates a shimmer timing problem.
FBShimmeringView *shimmerView = [[FBShimmeringView alloc]init];
//The following line works, but is unneccecery for common autolayout practices.
//FBShimmeringView *shimmerView = [[FBShimmeringView alloc]initWithFrame:self.view.bounds];
shimmerView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:shimmerView];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[shimmerView]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(shimmerView)]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[shimmerView]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(shimmerView)]];
UILabel *textLabel = [UILabel new];
textLabel.text = @"Shimmer Test";
textLabel.textColor = [UIColor whiteColor];
textLabel.textAlignment = NSTextAlignmentCenter;
shimmerView.contentView = textLabel;
shimmerView.shimmering = YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment