Merge pull request #1802 from jimmaye/uiactivity-indicator-background-access-bug
#1801: Makes sure UIActivityIndicator view is always initialized on main thread
This commit is contained in:
commit
7bf69862aa
|
@ -157,10 +157,10 @@ static char TAG_ACTIVITY_SHOW;
|
||||||
- (void)sd_addActivityIndicator {
|
- (void)sd_addActivityIndicator {
|
||||||
#if SD_UIKIT
|
#if SD_UIKIT
|
||||||
if (!self.activityIndicator) {
|
if (!self.activityIndicator) {
|
||||||
|
dispatch_main_async_safe(^{
|
||||||
self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:[self sd_getIndicatorStyle]];
|
self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:[self sd_getIndicatorStyle]];
|
||||||
self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
|
self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
|
||||||
|
|
||||||
dispatch_main_async_safe(^{
|
|
||||||
[self addSubview:self.activityIndicator];
|
[self addSubview:self.activityIndicator];
|
||||||
|
|
||||||
[self addConstraint:[NSLayoutConstraint constraintWithItem:self.activityIndicator
|
[self addConstraint:[NSLayoutConstraint constraintWithItem:self.activityIndicator
|
||||||
|
|
Loading…
Reference in New Issue