mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-17 22:23:52 +00:00
Perform the initial updateLoop iteration immediately after attaching the view
This commit is contained in:
@@ -132,11 +132,17 @@ static const int LABEL_DY = 20;
|
||||
[self addTarget:self action:@selector(hostClicked) forControlEvents:UIControlEventPrimaryActionTriggered];
|
||||
|
||||
[self updateContentsForHost:host];
|
||||
[self startUpdateLoop];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)didMoveToSuperview {
|
||||
// Start our update loop when we are added to our cell
|
||||
if (self.superview != nil && _host != nil) {
|
||||
[self updateLoop];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) updateBounds {
|
||||
float x = FLT_MAX;
|
||||
float y = FLT_MAX;
|
||||
@@ -187,17 +193,16 @@ static const int LABEL_DY = 20;
|
||||
[self updateBounds];
|
||||
}
|
||||
|
||||
- (void) startUpdateLoop {
|
||||
[self performSelector:@selector(updateLoop) withObject:self afterDelay:REFRESH_CYCLE];
|
||||
}
|
||||
|
||||
- (void) updateLoop {
|
||||
// Stop immediately if the view has been detached
|
||||
if (self.superview == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
[self updateContentsForHost:_host];
|
||||
|
||||
// Stop updating when we detach from our parent view
|
||||
if (self.superview != nil) {
|
||||
[self performSelector:@selector(updateLoop) withObject:self afterDelay:REFRESH_CYCLE];
|
||||
}
|
||||
// Queue the next refresh cycle
|
||||
[self performSelector:@selector(updateLoop) withObject:self afterDelay:REFRESH_CYCLE];
|
||||
}
|
||||
|
||||
- (void) hostLongClicked:(UILongPressGestureRecognizer*)gesture {
|
||||
|
||||
Reference in New Issue
Block a user