Add view controller finding functions
We need them to be able to present another view controller
This commit is contained in:
parent
5bb20b6f9b
commit
9be76e3674
20
RCTVideo.m
20
RCTVideo.m
@ -524,6 +524,26 @@ static NSString *const playbackBufferEmptyKeyPath = @"playbackBufferEmpty";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - View Controller retrieval
|
||||||
|
|
||||||
|
// http://stackoverflow.com/questions/1340434/get-to-uiviewcontroller-from-uiview/2596519
|
||||||
|
|
||||||
|
- (UIViewController *) firstAvailableUIViewController {
|
||||||
|
// convenience function for casting and to "mask" the recursive function
|
||||||
|
return (UIViewController *)[self traverseResponderChainForUIViewController];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) traverseResponderChainForUIViewController {
|
||||||
|
id nextResponder = [self nextResponder];
|
||||||
|
if ([nextResponder isKindOfClass:[UIViewController class]]) {
|
||||||
|
return nextResponder;
|
||||||
|
} else if ([nextResponder isKindOfClass:[UIView class]]) {
|
||||||
|
return [nextResponder traverseResponderChainForUIViewController];
|
||||||
|
} else {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Lifecycle
|
#pragma mark - Lifecycle
|
||||||
|
|
||||||
- (void)removeFromSuperview
|
- (void)removeFromSuperview
|
||||||
|
Loading…
Reference in New Issue
Block a user