OC:
- (UIView*)getTopView{
UIView*topView =nil;
UIApplication *app = [UIApplication sharedApplication];
if(app) {
UIWindow *topWindow = [[[UIApplication sharedApplication].windows sortedArrayUsingComparator:^NSComparisonResult(UIWindow *win1, UIWindow *win2) {
returnwin1.windowLevel- win2.windowLevel;
}]lastObject];
topView = [[topWindowsubviews]lastObject];
}
return topView;
}