Skip to content

Instantly share code, notes, and snippets.

@radiovisual
Forked from chrisvoss/PFLoadingView-Style
Last active August 29, 2015 14:18
Show Gist options
  • Save radiovisual/1ad438ecdb21478551ae to your computer and use it in GitHub Desktop.
Save radiovisual/1ad438ecdb21478551ae to your computer and use it in GitHub Desktop.
Style the default "Loading" view of PFQueryTableViewController the "hard way" as the current API does not provide this feature.
- (void)stylePFLoadingViewTheHardWay
{
UIColor *labelTextColor = [UIColor whiteColor];
UIColor *labelShadowColor = [UIColor darkGrayColor];
UIActivityIndicatorViewStyle activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
// go through all of the subviews until you find a PFLoadingView subclass
for (UIView *subview in self.view.subviews)
{
if ([subview class] == NSClassFromString(@"PFLoadingView"))
{
// find the loading label and loading activity indicator inside the PFLoadingView subviews
for (UIView *loadingViewSubview in subview.subviews) {
if ([loadingViewSubview isKindOfClass:[UILabel class]])
{
UILabel *label = (UILabel *)loadingViewSubview;
{
label.textColor = labelTextColor;
label.shadowColor = labelShadowColor;
}
}
if ([loadingViewSubview isKindOfClass:[UIActivityIndicatorView class]])
{
UIActivityIndicatorView *activityIndicatorView = (UIActivityIndicatorView *)loadingViewSubview;
activityIndicatorView.activityIndicatorViewStyle = activityIndicatorViewStyle;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment