├── Test ├── TopmostView │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── LaunchImage.launchimage │ │ │ ├── 568.png │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── KeyboardController.h │ ├── MainViewController.h │ ├── PushedViewController.h │ ├── PresentedViewController.h │ ├── AppDelegate.h │ ├── UIView+Toast.h │ ├── main.m │ ├── PushedViewController.m │ ├── PresentedViewController.m │ ├── Info.plist │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── UIView+Toast.m │ ├── AppDelegate.m │ ├── KeyboardController.m │ └── MainViewController.m └── TopmostView.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── project.pbxproj ├── TopmostView.podspec ├── TopmostView.h ├── LICENSE ├── .gitignore ├── README.md └── TopmostView.m /Test/TopmostView/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Test/TopmostView/Assets.xcassets/LaunchImage.launchimage/568.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarrisonXi/TopmostView/HEAD/Test/TopmostView/Assets.xcassets/LaunchImage.launchimage/568.png -------------------------------------------------------------------------------- /Test/TopmostView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Test/TopmostView/KeyboardController.h: -------------------------------------------------------------------------------- 1 | // 2 | // KeyboardController.h 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface KeyboardController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Test/TopmostView/MainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.h 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MainViewController : UIViewController 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /Test/TopmostView/PushedViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PushedViewController.h 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PushedViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Test/TopmostView/PresentedViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PresentedViewController.h 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PresentedViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Test/TopmostView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /Test/TopmostView/UIView+Toast.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Toast.h 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (Toast) 12 | 13 | - (void)showToast:(NSString *)messageStr; 14 | - (void)showToast:(NSString *)messageStr withYLocation:(CGFloat)yLocation; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Test/TopmostView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /TopmostView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "TopmostView" 3 | s.version = "1.0.0" 4 | s.summary = "Get topmost view for UIWindow. Supports iOS 7-11." 5 | s.homepage = "https://github.com/HarrisonXi/TopmostView" 6 | s.license = "MIT" 7 | s.author = { "HarrisonXi" => "gpra8764@gmail.com" } 8 | s.platform = :ios, "7.0" 9 | s.source = { :git => "https://github.com/HarrisonXi/TopmostView.git", :tag => "v1.0.0" } 10 | s.source_files = "*.{h,m}" 11 | end 12 | -------------------------------------------------------------------------------- /Test/TopmostView/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "8.0", 8 | "subtype" : "1366h", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "orientation" : "portrait", 13 | "idiom" : "iphone", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "extent" : "full-screen", 20 | "idiom" : "iphone", 21 | "subtype" : "retina4", 22 | "filename" : "568.png", 23 | "minimum-system-version" : "7.0", 24 | "orientation" : "portrait", 25 | "scale" : "2x" 26 | } 27 | ], 28 | "info" : { 29 | "version" : 1, 30 | "author" : "xcode" 31 | } 32 | } -------------------------------------------------------------------------------- /TopmostView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TopmostView.h 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TopmostView : UIView 12 | 13 | // Get topmost view for the application window. 14 | // The application window is [UIApplicationDelegate window]. 15 | + (instancetype)viewForApplicationWindow; 16 | 17 | // Get topmost view for a new window over status bar. 18 | + (instancetype)viewForStatusBarWindow; 19 | 20 | // Get topmost view for a new window over alert window. 21 | // It is for iOS 7/8, UIAlertView cteate a new window which level = UIWindowLevelAlert. 22 | // For iOS >= 9, UIAlertController does not create a new window. 23 | + (instancetype)viewForAlertWindow; 24 | 25 | // Get topmost view for the keyboard window. 26 | + (instancetype)viewForKeyboardWindow; 27 | 28 | // Get topmost view for specified window. 29 | + (instancetype)viewForWindow:(UIWindow *)window; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2016-2017 http://harrisonxi.com/ 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /Test/TopmostView/PushedViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PushedViewController.m 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import "PushedViewController.h" 10 | #import "TopmostView.h" 11 | #import "UIView+Toast.h" 12 | 13 | @interface PushedViewController () 14 | 15 | @property (nonatomic, strong) UIButton *popButton; 16 | 17 | @end 18 | 19 | @implementation PushedViewController 20 | 21 | - (instancetype)init 22 | { 23 | if (self = [super init]) { 24 | self.edgesForExtendedLayout = UIRectEdgeNone; 25 | self.title = @"Pushed"; 26 | } 27 | return self; 28 | } 29 | 30 | - (void)viewDidLoad { 31 | [super viewDidLoad]; 32 | self.view.backgroundColor = [UIColor colorWithRed:1 green:1 blue:0.9 alpha:1]; 33 | [self.view addSubview:self.popButton]; 34 | } 35 | 36 | - (UIButton *)popButton 37 | { 38 | if (!_popButton) { 39 | _popButton = [UIButton buttonWithType:UIButtonTypeSystem]; 40 | [_popButton setTitle:@"Pop" forState:UIControlStateNormal]; 41 | _popButton.frame = CGRectMake(10, 10, 100, 50); 42 | [_popButton addTarget:self action:@selector(popAction) forControlEvents:UIControlEventTouchUpInside]; 43 | } 44 | return _popButton; 45 | } 46 | 47 | - (void)popAction 48 | { 49 | [self.navigationController popViewControllerAnimated:YES]; 50 | [[TopmostView viewForApplicationWindow] showToast:@"pop"]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Test/TopmostView/PresentedViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PresentedViewController.m 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import "PresentedViewController.h" 10 | #import "TopmostView.h" 11 | #import "UIView+Toast.h" 12 | 13 | @interface PresentedViewController () 14 | 15 | @property (nonatomic, strong) UIButton *dismissButton; 16 | 17 | @end 18 | 19 | @implementation PresentedViewController 20 | 21 | - (instancetype)init 22 | { 23 | if (self = [super init]) { 24 | self.edgesForExtendedLayout = UIRectEdgeNone; 25 | self.title = @"Presented"; 26 | } 27 | return self; 28 | } 29 | 30 | - (void)viewDidLoad { 31 | [super viewDidLoad]; 32 | self.view.backgroundColor = [UIColor colorWithRed:0.9 green:1 blue:0.9 alpha:1]; 33 | [self.view addSubview:self.dismissButton]; 34 | } 35 | 36 | - (UIButton *)dismissButton 37 | { 38 | if (!_dismissButton) { 39 | _dismissButton = [UIButton buttonWithType:UIButtonTypeSystem]; 40 | [_dismissButton setTitle:@"Dismiss" forState:UIControlStateNormal]; 41 | _dismissButton.frame = CGRectMake(10, 10, 100, 50); 42 | [_dismissButton addTarget:self action:@selector(dismissAction) forControlEvents:UIControlEventTouchUpInside]; 43 | } 44 | return _dismissButton; 45 | } 46 | 47 | - (void)dismissAction 48 | { 49 | [self.navigationController dismissViewControllerAnimated:YES completion:nil]; 50 | [[TopmostView viewForApplicationWindow] showToast:@"dismiss"]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Test/TopmostView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | UIInterfaceOrientationPortraitUpsideDown 37 | 38 | UISupportedInterfaceOrientations~ipad 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationPortraitUpsideDown 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Test/TopmostView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Test/TopmostView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /Test/TopmostView/UIView+Toast.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Toast.m 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import "UIView+Toast.h" 10 | 11 | @implementation UIView (Toast) 12 | 13 | - (void)showToast:(NSString *)messageStr 14 | { 15 | [self showToast:messageStr withYLocation:2 / 3.0]; 16 | } 17 | 18 | - (void)showToast:(NSString *)messageStr withYLocation:(CGFloat)yLocation 19 | { 20 | UIFont *messageFont = [UIFont systemFontOfSize:16]; 21 | CGSize messageSize = [messageStr sizeWithAttributes:@{NSFontAttributeName : messageFont}]; 22 | __block UILabel *messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, messageSize.width + 32, messageSize.height + 32)]; 23 | messageLabel.numberOfLines = 0; 24 | messageLabel.layer.cornerRadius = 8; 25 | messageLabel.layer.masksToBounds = YES; 26 | messageLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0.8]; 27 | messageLabel.font = messageFont; 28 | messageLabel.text = messageStr; 29 | messageLabel.textAlignment = NSTextAlignmentCenter; 30 | messageLabel.textColor = [UIColor whiteColor]; 31 | messageLabel.center = CGPointMake(CGRectGetWidth(self.bounds) / 2, CGRectGetHeight(self.bounds) * yLocation); 32 | messageLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin; 33 | messageLabel.alpha = 0; 34 | [self addSubview:messageLabel]; 35 | 36 | [UIView animateWithDuration:0.25 animations:^{ 37 | messageLabel.alpha = 1; 38 | } completion:^(BOOL finished) { 39 | [UIView animateWithDuration:0.25 delay:2.5 options:0 animations:^{ 40 | messageLabel.alpha = 0; 41 | } completion:^(BOOL finished) { 42 | [messageLabel removeFromSuperview]; 43 | }]; 44 | }]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![CocoaPods](https://img.shields.io/cocoapods/v/TopmostView.svg)]() [![CocoaPods](https://img.shields.io/cocoapods/p/TopmostView.svg)]() [![CocoaPods](https://img.shields.io/cocoapods/l/TopmostView.svg)]() 2 | 3 | # TopmostView 4 | 5 | Get topmost view for UIWindow. The topmost view can rotate correctly with devices. The test project contains a simple toast implementation. Supports iOS 7-11. 6 | 7 | Get topmost view for the application window: 8 | 9 | // The application window is [UIApplicationDelegate window]. 10 | [TopmostView viewForApplicationWindow] 11 | 12 | Get topmost view for the keyboard window: 13 | 14 | [TopmostView viewForKeyboardWindow] 15 | 16 | Get topmost view for a new window over status bar: 17 | 18 | [TopmostView viewForStatusBarWindow] 19 | 20 | Get topmost view for a new window over alert view: 21 | 22 | // It is for iOS 7/8, UIAlertView cteate a new window which level = UIWindowLevelAlert. 23 | // For iOS >= 9, UIAlertController does not create a new window. 24 | [TopmostView viewForAlertWindow] 25 | 26 | Get topmost view for specified window: 27 | 28 | [TopmostView viewForWindow:window] 29 | 30 | # 中文介绍 31 | 32 | 获得 UIWindow 里最顶层的 view。这个最顶层的 view 可以随着设备正常的旋转。另外测试工程里包含一个简单的 toast 实现。支持 iOS 7-11。 33 | 34 | 获得应用程序 window 里最顶层的 view: 35 | 36 | // 应用程序 window 的值是 [UIApplicationDelegate window]。 37 | [TopmostView viewForApplicationWindow] 38 | 39 | 获得键盘 window 里最顶层的 view: 40 | 41 | [TopmostView viewForKeyboardWindow] 42 | 43 | 获得一个覆盖在状态条之上的新 window 里最顶层的 view: 44 | 45 | [TopmostView viewForStatusBarWindow] 46 | 47 | 获得一个覆盖在 Alert 弹窗之上的新 window 里最顶层的 view: 48 | 49 | // 这是用在 iOS 7/8 上的,UIAlertView 会创建一个 level 为 UIWindowLevelAlert 的 window。 50 | // 在 iOS >= 9 的设备上,UIAlertController 是不会创建新 window 的。 51 | [TopmostView viewForAlertWindow] 52 | 53 | 获得指定 window 里最顶层的 view: 54 | 55 | [TopmostView viewForWindow:window] 56 | 57 | 实现细节逻辑相关blog:[iOS系统的键盘window](http://blog.harrisonxi.com/2017/02/iOS%E7%B3%BB%E7%BB%9F%E7%9A%84%E9%94%AE%E7%9B%98window.html),[iOS系统window的旋转及自定义window的问题](http://blog.harrisonxi.com/2017/02/iOS%E7%B3%BB%E7%BB%9Fwindow%E7%9A%84%E6%97%8B%E8%BD%AC%E5%8F%8A%E8%87%AA%E5%AE%9A%E4%B9%89window%E7%9A%84%E9%97%AE%E9%A2%98.html) 58 | -------------------------------------------------------------------------------- /Test/TopmostView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "MainViewController.h" 11 | #import "TopmostView.h" 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 21 | self.window.backgroundColor = [UIColor whiteColor]; 22 | self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[MainViewController new]]; 23 | [self.window makeKeyAndVisible]; 24 | return YES; 25 | } 26 | 27 | - (void)applicationWillResignActive:(UIApplication *)application { 28 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 29 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 30 | } 31 | 32 | - (void)applicationDidEnterBackground:(UIApplication *)application { 33 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 35 | } 36 | 37 | - (void)applicationWillEnterForeground:(UIApplication *)application { 38 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 39 | } 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | - (void)applicationWillTerminate:(UIApplication *)application { 46 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Test/TopmostView/KeyboardController.m: -------------------------------------------------------------------------------- 1 | // 2 | // KeyboardController.m 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import "KeyboardController.h" 10 | #import "TopmostView.h" 11 | #import "UIView+Toast.h" 12 | 13 | @interface KeyboardController () 14 | 15 | @property (nonatomic, strong) UITextField *textField; 16 | @property (nonatomic, strong) UIButton *toast1Button; 17 | @property (nonatomic, strong) UIButton *toast2Button; 18 | @property (nonatomic, strong) UIButton *toast3Button; 19 | 20 | @end 21 | 22 | @implementation KeyboardController 23 | 24 | - (instancetype)init 25 | { 26 | if (self = [super init]) { 27 | self.edgesForExtendedLayout = UIRectEdgeNone; 28 | self.title = @"Keyboard"; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)viewDidLoad { 34 | [super viewDidLoad]; 35 | self.view.backgroundColor = [UIColor colorWithRed:1 green:0.9 blue:0.9 alpha:1]; 36 | [self.view addSubview:self.textField]; 37 | [self.view addSubview:self.toast1Button]; 38 | [self.view addSubview:self.toast2Button]; 39 | [self.view addSubview:self.toast3Button]; 40 | } 41 | 42 | - (void)viewDidAppear:(BOOL)animated 43 | { 44 | [super viewDidAppear:animated]; 45 | 46 | [self.textField becomeFirstResponder]; 47 | } 48 | 49 | - (BOOL)textFieldShouldReturn:(UITextField *)textField 50 | { 51 | [textField resignFirstResponder]; 52 | return NO; 53 | } 54 | 55 | - (UITextField *)textField 56 | { 57 | if (!_textField) { 58 | _textField = [UITextField new]; 59 | _textField.borderStyle = UITextBorderStyleRoundedRect; 60 | _textField.returnKeyType = UIReturnKeyDone; 61 | _textField.frame = CGRectMake(10, 10, 200, 50); 62 | _textField.delegate = self; 63 | } 64 | return _textField; 65 | } 66 | 67 | - (UIButton *)toast1Button 68 | { 69 | if (!_toast1Button) { 70 | _toast1Button = [UIButton buttonWithType:UIButtonTypeSystem]; 71 | [_toast1Button setTitle:@"Applicatoin" forState:UIControlStateNormal]; 72 | _toast1Button.frame = CGRectMake(10, 70, 200, 50); 73 | [_toast1Button addTarget:self action:@selector(toastAction:) forControlEvents:UIControlEventTouchUpInside]; 74 | } 75 | return _toast1Button; 76 | } 77 | 78 | - (UIButton *)toast2Button 79 | { 80 | if (!_toast2Button) { 81 | _toast2Button = [UIButton buttonWithType:UIButtonTypeSystem]; 82 | [_toast2Button setTitle:@"Status Bar" forState:UIControlStateNormal]; 83 | _toast2Button.frame = CGRectMake(10, 130, 200, 50); 84 | [_toast2Button addTarget:self action:@selector(toastAction:) forControlEvents:UIControlEventTouchUpInside]; 85 | } 86 | return _toast2Button; 87 | } 88 | 89 | - (UIButton *)toast3Button 90 | { 91 | if (!_toast3Button) { 92 | _toast3Button = [UIButton buttonWithType:UIButtonTypeSystem]; 93 | [_toast3Button setTitle:@"Keyboard" forState:UIControlStateNormal]; 94 | _toast3Button.frame = CGRectMake(10, 190, 200, 50); 95 | [_toast3Button addTarget:self action:@selector(toastAction:) forControlEvents:UIControlEventTouchUpInside]; 96 | } 97 | return _toast3Button; 98 | } 99 | 100 | - (void)toastAction:(id)sender 101 | { 102 | if (sender == self.toast1Button) { 103 | [[TopmostView viewForApplicationWindow] showToast:@"~\n application \n~"]; 104 | } else if (sender == self.toast2Button) { 105 | [[TopmostView viewForStatusBarWindow] showToast:@"~\n status bar \n~"]; 106 | } else if (sender == self.toast3Button) { 107 | [[TopmostView viewForKeyboardWindow] showToast:@"~\n keyboard \n~"]; 108 | } 109 | } 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /Test/TopmostView/MainViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.m 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import "MainViewController.h" 10 | #import "PushedViewController.h" 11 | #import "PresentedViewController.h" 12 | #import "KeyboardController.h" 13 | #import "TopmostView.h" 14 | #import "UIView+Toast.h" 15 | 16 | @interface MainViewController () 17 | 18 | @property (nonatomic, strong) UIButton *pushButton; 19 | @property (nonatomic, strong) UIButton *presentButton; 20 | @property (nonatomic, strong) UIButton *keyboardButton; 21 | @property (nonatomic, strong) UIButton *statusBarButton; 22 | @property (nonatomic, strong) UIButton *alertButton; 23 | 24 | @property (nonatomic, strong) UIView *statusBarColorView; 25 | @property (nonatomic, strong) NSArray *colorArray; 26 | @property (nonatomic, assign) NSInteger colorIndex; 27 | 28 | @end 29 | 30 | @implementation MainViewController 31 | 32 | - (instancetype)init 33 | { 34 | if (self = [super init]) { 35 | self.edgesForExtendedLayout = UIRectEdgeNone; 36 | self.title = @"TopmostViewDemo"; 37 | self.colorArray = @[[UIColor redColor], [UIColor greenColor], [UIColor blueColor]]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)viewDidLoad { 43 | [super viewDidLoad]; 44 | self.view.backgroundColor = [UIColor whiteColor]; 45 | [self.view addSubview:self.pushButton]; 46 | [self.view addSubview:self.presentButton]; 47 | [self.view addSubview:self.keyboardButton]; 48 | [self.view addSubview:self.statusBarButton]; 49 | [self.view addSubview:self.alertButton]; 50 | } 51 | 52 | - (UIButton *)pushButton 53 | { 54 | if (!_pushButton) { 55 | _pushButton = [UIButton buttonWithType:UIButtonTypeSystem]; 56 | [_pushButton setTitle:@"Push" forState:UIControlStateNormal]; 57 | _pushButton.frame = CGRectMake(10, 10, 100, 50); 58 | [_pushButton addTarget:self action:@selector(pushAction) forControlEvents:UIControlEventTouchUpInside]; 59 | } 60 | return _pushButton; 61 | } 62 | 63 | - (UIButton *)presentButton 64 | { 65 | if (!_presentButton) { 66 | _presentButton = [UIButton buttonWithType:UIButtonTypeSystem]; 67 | [_presentButton setTitle:@"Present" forState:UIControlStateNormal]; 68 | _presentButton.frame = CGRectMake(10, 70, 100, 50); 69 | [_presentButton addTarget:self action:@selector(presentAction) forControlEvents:UIControlEventTouchUpInside]; 70 | } 71 | return _presentButton; 72 | } 73 | 74 | - (UIButton *)keyboardButton 75 | { 76 | if (!_keyboardButton) { 77 | _keyboardButton = [UIButton buttonWithType:UIButtonTypeSystem]; 78 | [_keyboardButton setTitle:@"Keyboard" forState:UIControlStateNormal]; 79 | _keyboardButton.frame = CGRectMake(10, 130, 100, 50); 80 | [_keyboardButton addTarget:self action:@selector(keyboardAction) forControlEvents:UIControlEventTouchUpInside]; 81 | } 82 | return _keyboardButton; 83 | } 84 | 85 | - (UIButton *)statusBarButton 86 | { 87 | if (!_statusBarButton) { 88 | _statusBarButton = [UIButton buttonWithType:UIButtonTypeSystem]; 89 | [_statusBarButton setTitle:@"Status Bar" forState:UIControlStateNormal]; 90 | _statusBarButton.frame = CGRectMake(10, 190, 100, 50); 91 | [_statusBarButton addTarget:self action:@selector(changeColorAction) forControlEvents:UIControlEventTouchUpInside]; 92 | } 93 | return _statusBarButton; 94 | } 95 | 96 | - (UIView *)statusBarColorView 97 | { 98 | if (!_statusBarColorView) { 99 | TopmostView *topmostView = [TopmostView viewForStatusBarWindow]; 100 | _statusBarColorView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetWidth(topmostView.bounds) - 64, 0, 64, 64)]; 101 | _statusBarColorView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; 102 | [topmostView addSubview:_statusBarColorView]; 103 | } 104 | return _statusBarColorView; 105 | } 106 | 107 | - (UIButton *)alertButton 108 | { 109 | if (!_alertButton) { 110 | _alertButton = [UIButton buttonWithType:UIButtonTypeSystem]; 111 | [_alertButton setTitle:@"Alert" forState:UIControlStateNormal]; 112 | _alertButton.frame = CGRectMake(10, 250, 100, 50); 113 | [_alertButton addTarget:self action:@selector(alertAction) forControlEvents:UIControlEventTouchUpInside]; 114 | } 115 | return _alertButton; 116 | } 117 | 118 | - (void)pushAction 119 | { 120 | [self.navigationController pushViewController:[PushedViewController new] animated:YES]; 121 | [[TopmostView viewForApplicationWindow] showToast:@"push"]; 122 | } 123 | 124 | - (void)presentAction 125 | { 126 | [self.navigationController presentViewController:[[UINavigationController alloc] initWithRootViewController:[PresentedViewController new]] animated:YES completion:nil]; 127 | [[TopmostView viewForApplicationWindow] showToast:@"present"]; 128 | } 129 | 130 | - (void)keyboardAction 131 | { 132 | [self.navigationController pushViewController:[KeyboardController new] animated:YES]; 133 | } 134 | 135 | - (void)changeColorAction 136 | { 137 | self.statusBarColorView.backgroundColor = self.colorArray[self.colorIndex]; 138 | self.colorIndex = (self.colorIndex + 1) % [self.colorArray count]; 139 | } 140 | 141 | - (void)alertAction 142 | { 143 | if ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0f) { 144 | UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:@"Alert" preferredStyle:UIAlertControllerStyleAlert]; 145 | [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]]; 146 | [self.navigationController presentViewController:alertController animated:YES completion:nil]; 147 | } else { 148 | UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:@"Alert" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 149 | [alertView show]; 150 | [[TopmostView viewForStatusBarWindow] showToast:@"~\n status bar \n~" withYLocation:0.6]; 151 | } 152 | [[TopmostView viewForAlertWindow] showToast:@"~\n alert \n~" withYLocation:0.4]; 153 | } 154 | 155 | @end 156 | -------------------------------------------------------------------------------- /TopmostView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TopmostView.m 3 | // TopmostView 4 | // 5 | // Created by HarrisonXi on 16/2/19. 6 | // Copyright (c) 2016-2017 http://harrisonxi.com/. All rights reserved. 7 | // 8 | 9 | #import "TopmostView.h" 10 | 11 | @interface TopmostView () 12 | 13 | @property (nonatomic, weak) UIWindow *tv_window; 14 | 15 | @end 16 | 17 | @implementation TopmostView 18 | 19 | - (instancetype)initWithWindow:(UIWindow *)window 20 | { 21 | if (self = [super init]) { 22 | self.tv_window = window; 23 | self.backgroundColor = [UIColor clearColor]; 24 | self.userInteractionEnabled = NO; 25 | UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; 26 | [self updateWithOrientation:orientation]; 27 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeOrientationHandler:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil]; 28 | } 29 | return self; 30 | } 31 | 32 | - (void)dealloc 33 | { 34 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarOrientationNotification object:nil]; 35 | } 36 | 37 | - (void)updateTransformWithOrientation:(UIInterfaceOrientation)orientation 38 | { 39 | CGFloat width = CGRectGetWidth(self.tv_window.bounds); 40 | CGFloat height = CGRectGetHeight(self.tv_window.bounds); 41 | if (width > height) { 42 | CGFloat temp = width; 43 | width = height; 44 | height = temp; 45 | } 46 | CGAffineTransform transform; 47 | switch (orientation) { 48 | case UIInterfaceOrientationLandscapeLeft: 49 | transform = CGAffineTransformMakeRotation(-M_PI_2); 50 | break; 51 | case UIInterfaceOrientationLandscapeRight: 52 | transform = CGAffineTransformMakeRotation(M_PI_2); 53 | break; 54 | case UIInterfaceOrientationPortraitUpsideDown: 55 | transform = CGAffineTransformMakeRotation(-M_PI); 56 | break; 57 | default: 58 | transform = CGAffineTransformIdentity; 59 | break; 60 | } 61 | self.transform = transform; 62 | self.frame = CGRectMake(0, 0, width, height); 63 | } 64 | 65 | - (void)updateFrameWithOrientation:(UIInterfaceOrientation)orientation 66 | { 67 | CGFloat width = CGRectGetWidth(self.tv_window.bounds); 68 | CGFloat height = CGRectGetHeight(self.tv_window.bounds); 69 | if (width > height) { 70 | CGFloat temp = width; 71 | width = height; 72 | height = temp; 73 | } 74 | switch (orientation) { 75 | case UIInterfaceOrientationLandscapeLeft: 76 | case UIInterfaceOrientationLandscapeRight: 77 | self.frame = CGRectMake(0, 0, height, width); 78 | break; 79 | default: 80 | self.frame = CGRectMake(0, 0, width, height); 81 | break; 82 | } 83 | } 84 | 85 | - (void)updateWithOrientation:(UIInterfaceOrientation)orientation 86 | { 87 | BOOL isIos7 = [[UIDevice currentDevice].systemVersion floatValue] < 8.0; 88 | BOOL isKeyboardWindow = [self.tv_window isKindOfClass:NSClassFromString(@"UITextEffectsWindow")]; 89 | if (isIos7 == YES && isKeyboardWindow == NO) { 90 | [self updateTransformWithOrientation:orientation]; 91 | } else { 92 | [self updateFrameWithOrientation:orientation]; 93 | } 94 | } 95 | 96 | - (void)changeOrientationHandler:(NSNotification *)notification 97 | { 98 | if (notification.name == UIApplicationWillChangeStatusBarOrientationNotification) { 99 | [UIView animateWithDuration:[UIApplication sharedApplication].statusBarOrientationAnimationDuration animations:^{ 100 | UIInterfaceOrientation orientation = (UIInterfaceOrientation)[notification.userInfo[UIApplicationStatusBarOrientationUserInfoKey] integerValue]; 101 | [self updateWithOrientation:orientation]; 102 | }]; 103 | } 104 | } 105 | 106 | + (instancetype)viewForApplicationWindow 107 | { 108 | return [self viewForWindow:[[UIApplication sharedApplication].delegate window]]; 109 | } 110 | 111 | + (instancetype)viewForStatusBarWindow 112 | { 113 | static dispatch_once_t once; 114 | static UIWindow *statusBarWindow_; 115 | dispatch_once(&once, ^{ 116 | statusBarWindow_ = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 117 | statusBarWindow_.rootViewController = [UIViewController new]; 118 | statusBarWindow_.backgroundColor = [UIColor clearColor]; 119 | statusBarWindow_.windowLevel = UIWindowLevelStatusBar + 50; 120 | statusBarWindow_.userInteractionEnabled = NO; 121 | statusBarWindow_.hidden = NO; 122 | }); 123 | return [self viewForWindow:statusBarWindow_]; 124 | } 125 | 126 | + (instancetype)viewForAlertWindow 127 | { 128 | static dispatch_once_t once; 129 | static UIWindow *alertWindow_; 130 | dispatch_once(&once, ^{ 131 | alertWindow_ = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 132 | alertWindow_.rootViewController = [UIViewController new]; 133 | alertWindow_.backgroundColor = [UIColor clearColor]; 134 | alertWindow_.windowLevel = UIWindowLevelAlert + 50; 135 | alertWindow_.userInteractionEnabled = NO; 136 | alertWindow_.hidden = NO; 137 | }); 138 | return [self viewForWindow:alertWindow_]; 139 | } 140 | 141 | + (instancetype)viewForKeyboardWindow 142 | { 143 | for (UIWindow *window in [[UIApplication sharedApplication].windows reverseObjectEnumerator]) { 144 | if ([window isKindOfClass:NSClassFromString(@"UITextEffectsWindow")] && window.hidden == NO && window.alpha > 0) { 145 | return [self viewForWindow:window]; 146 | } 147 | } 148 | return nil; 149 | } 150 | 151 | + (instancetype)viewForWindow:(UIWindow *)window 152 | { 153 | #ifdef TV_DEMO 154 | for (UIWindow *win in [UIApplication sharedApplication].windows) { 155 | NSLog(@"window class: %@, window level: %.0f", NSStringFromClass([win class]), win.windowLevel); 156 | if (![win isMemberOfClass:[UIWindow class]]) { 157 | for (UIView *subview in win.subviews) { 158 | NSLog(@" subview class: %@", NSStringFromClass([subview class])); 159 | } 160 | } 161 | } 162 | #endif 163 | TopmostView *topmostView = nil; 164 | for (UIView *subview in window.subviews) { 165 | if ([subview isKindOfClass:[TopmostView class]]) { 166 | topmostView = (TopmostView *)subview; 167 | break; 168 | } 169 | } 170 | if (!topmostView) { 171 | topmostView = [[self alloc] initWithWindow:window]; 172 | [window addSubview:topmostView]; 173 | } 174 | [topmostView.tv_window bringSubviewToFront:topmostView]; 175 | return topmostView; 176 | } 177 | 178 | @end 179 | -------------------------------------------------------------------------------- /Test/TopmostView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9213F3EF1C76C3BC00B7221C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9213F3EE1C76C3BC00B7221C /* main.m */; }; 11 | 9213F3F21C76C3BC00B7221C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9213F3F11C76C3BC00B7221C /* AppDelegate.m */; }; 12 | 9213F3F51C76C3BC00B7221C /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9213F3F41C76C3BC00B7221C /* MainViewController.m */; }; 13 | 9213F3FA1C76C3BC00B7221C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9213F3F91C76C3BC00B7221C /* Assets.xcassets */; }; 14 | 9213F3FD1C76C3BC00B7221C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9213F3FB1C76C3BC00B7221C /* LaunchScreen.storyboard */; }; 15 | 9213F4061C76C98A00B7221C /* TopmostView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9213F4051C76C98A00B7221C /* TopmostView.m */; }; 16 | 9213F4091C76CCD300B7221C /* PushedViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9213F4081C76CCD300B7221C /* PushedViewController.m */; }; 17 | 9213F40F1C76CDB100B7221C /* PresentedViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9213F40E1C76CDB100B7221C /* PresentedViewController.m */; }; 18 | 9213F4121C76F65200B7221C /* UIView+Toast.m in Sources */ = {isa = PBXBuildFile; fileRef = 9213F4111C76F65200B7221C /* UIView+Toast.m */; }; 19 | 921C80A21C7719AC002A5F26 /* KeyboardController.m in Sources */ = {isa = PBXBuildFile; fileRef = 921C80A11C7719AC002A5F26 /* KeyboardController.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 9213F3EA1C76C3BC00B7221C /* TopmostView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TopmostView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 9213F3EE1C76C3BC00B7221C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 25 | 9213F3F01C76C3BC00B7221C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 26 | 9213F3F11C76C3BC00B7221C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 27 | 9213F3F31C76C3BC00B7221C /* MainViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; 28 | 9213F3F41C76C3BC00B7221C /* MainViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; 29 | 9213F3F91C76C3BC00B7221C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 30 | 9213F3FC1C76C3BC00B7221C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 31 | 9213F3FE1C76C3BC00B7221C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 9213F4041C76C98A00B7221C /* TopmostView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TopmostView.h; path = ../TopmostView.h; sourceTree = ""; }; 33 | 9213F4051C76C98A00B7221C /* TopmostView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TopmostView.m; path = ../TopmostView.m; sourceTree = ""; }; 34 | 9213F4071C76CCD300B7221C /* PushedViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PushedViewController.h; sourceTree = ""; }; 35 | 9213F4081C76CCD300B7221C /* PushedViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PushedViewController.m; sourceTree = ""; }; 36 | 9213F40D1C76CDB100B7221C /* PresentedViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PresentedViewController.h; sourceTree = ""; }; 37 | 9213F40E1C76CDB100B7221C /* PresentedViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PresentedViewController.m; sourceTree = ""; }; 38 | 9213F4101C76F65200B7221C /* UIView+Toast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Toast.h"; sourceTree = ""; }; 39 | 9213F4111C76F65200B7221C /* UIView+Toast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Toast.m"; sourceTree = ""; }; 40 | 921C80A01C7719AC002A5F26 /* KeyboardController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyboardController.h; sourceTree = ""; }; 41 | 921C80A11C7719AC002A5F26 /* KeyboardController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KeyboardController.m; sourceTree = ""; }; 42 | 926BBFDC1E1CDAA5003613A0 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 9213F3E71C76C3BC00B7221C /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | /* End PBXFrameworksBuildPhase section */ 54 | 55 | /* Begin PBXGroup section */ 56 | 9213F3E11C76C3BC00B7221C = { 57 | isa = PBXGroup; 58 | children = ( 59 | 926BBFDC1E1CDAA5003613A0 /* LICENSE */, 60 | 9213F4041C76C98A00B7221C /* TopmostView.h */, 61 | 9213F4051C76C98A00B7221C /* TopmostView.m */, 62 | 9213F3EC1C76C3BC00B7221C /* TopmostView */, 63 | 9213F3EB1C76C3BC00B7221C /* Products */, 64 | ); 65 | sourceTree = ""; 66 | }; 67 | 9213F3EB1C76C3BC00B7221C /* Products */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 9213F3EA1C76C3BC00B7221C /* TopmostView.app */, 71 | ); 72 | name = Products; 73 | sourceTree = ""; 74 | }; 75 | 9213F3EC1C76C3BC00B7221C /* TopmostView */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 9213F3F01C76C3BC00B7221C /* AppDelegate.h */, 79 | 9213F3F11C76C3BC00B7221C /* AppDelegate.m */, 80 | 9213F4101C76F65200B7221C /* UIView+Toast.h */, 81 | 9213F4111C76F65200B7221C /* UIView+Toast.m */, 82 | 9213F3F31C76C3BC00B7221C /* MainViewController.h */, 83 | 9213F3F41C76C3BC00B7221C /* MainViewController.m */, 84 | 9213F4071C76CCD300B7221C /* PushedViewController.h */, 85 | 9213F4081C76CCD300B7221C /* PushedViewController.m */, 86 | 9213F40D1C76CDB100B7221C /* PresentedViewController.h */, 87 | 9213F40E1C76CDB100B7221C /* PresentedViewController.m */, 88 | 921C80A01C7719AC002A5F26 /* KeyboardController.h */, 89 | 921C80A11C7719AC002A5F26 /* KeyboardController.m */, 90 | 9213F3F91C76C3BC00B7221C /* Assets.xcassets */, 91 | 9213F3FB1C76C3BC00B7221C /* LaunchScreen.storyboard */, 92 | 9213F3FE1C76C3BC00B7221C /* Info.plist */, 93 | 9213F3ED1C76C3BC00B7221C /* Supporting Files */, 94 | ); 95 | path = TopmostView; 96 | sourceTree = ""; 97 | }; 98 | 9213F3ED1C76C3BC00B7221C /* Supporting Files */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 9213F3EE1C76C3BC00B7221C /* main.m */, 102 | ); 103 | name = "Supporting Files"; 104 | sourceTree = ""; 105 | }; 106 | /* End PBXGroup section */ 107 | 108 | /* Begin PBXNativeTarget section */ 109 | 9213F3E91C76C3BC00B7221C /* TopmostView */ = { 110 | isa = PBXNativeTarget; 111 | buildConfigurationList = 9213F4011C76C3BC00B7221C /* Build configuration list for PBXNativeTarget "TopmostView" */; 112 | buildPhases = ( 113 | 9213F3E61C76C3BC00B7221C /* Sources */, 114 | 9213F3E71C76C3BC00B7221C /* Frameworks */, 115 | 9213F3E81C76C3BC00B7221C /* Resources */, 116 | ); 117 | buildRules = ( 118 | ); 119 | dependencies = ( 120 | ); 121 | name = TopmostView; 122 | productName = TopmostView; 123 | productReference = 9213F3EA1C76C3BC00B7221C /* TopmostView.app */; 124 | productType = "com.apple.product-type.application"; 125 | }; 126 | /* End PBXNativeTarget section */ 127 | 128 | /* Begin PBXProject section */ 129 | 9213F3E21C76C3BC00B7221C /* Project object */ = { 130 | isa = PBXProject; 131 | attributes = { 132 | LastUpgradeCheck = 0720; 133 | ORGANIZATIONNAME = "http://harrisonxi.com/"; 134 | TargetAttributes = { 135 | 9213F3E91C76C3BC00B7221C = { 136 | CreatedOnToolsVersion = 7.2; 137 | }; 138 | }; 139 | }; 140 | buildConfigurationList = 9213F3E51C76C3BC00B7221C /* Build configuration list for PBXProject "TopmostView" */; 141 | compatibilityVersion = "Xcode 3.2"; 142 | developmentRegion = English; 143 | hasScannedForEncodings = 0; 144 | knownRegions = ( 145 | en, 146 | Base, 147 | ); 148 | mainGroup = 9213F3E11C76C3BC00B7221C; 149 | productRefGroup = 9213F3EB1C76C3BC00B7221C /* Products */; 150 | projectDirPath = ""; 151 | projectRoot = ""; 152 | targets = ( 153 | 9213F3E91C76C3BC00B7221C /* TopmostView */, 154 | ); 155 | }; 156 | /* End PBXProject section */ 157 | 158 | /* Begin PBXResourcesBuildPhase section */ 159 | 9213F3E81C76C3BC00B7221C /* Resources */ = { 160 | isa = PBXResourcesBuildPhase; 161 | buildActionMask = 2147483647; 162 | files = ( 163 | 9213F3FD1C76C3BC00B7221C /* LaunchScreen.storyboard in Resources */, 164 | 9213F3FA1C76C3BC00B7221C /* Assets.xcassets in Resources */, 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | /* End PBXResourcesBuildPhase section */ 169 | 170 | /* Begin PBXSourcesBuildPhase section */ 171 | 9213F3E61C76C3BC00B7221C /* Sources */ = { 172 | isa = PBXSourcesBuildPhase; 173 | buildActionMask = 2147483647; 174 | files = ( 175 | 9213F3F51C76C3BC00B7221C /* MainViewController.m in Sources */, 176 | 9213F4061C76C98A00B7221C /* TopmostView.m in Sources */, 177 | 9213F3F21C76C3BC00B7221C /* AppDelegate.m in Sources */, 178 | 921C80A21C7719AC002A5F26 /* KeyboardController.m in Sources */, 179 | 9213F40F1C76CDB100B7221C /* PresentedViewController.m in Sources */, 180 | 9213F4121C76F65200B7221C /* UIView+Toast.m in Sources */, 181 | 9213F3EF1C76C3BC00B7221C /* main.m in Sources */, 182 | 9213F4091C76CCD300B7221C /* PushedViewController.m in Sources */, 183 | ); 184 | runOnlyForDeploymentPostprocessing = 0; 185 | }; 186 | /* End PBXSourcesBuildPhase section */ 187 | 188 | /* Begin PBXVariantGroup section */ 189 | 9213F3FB1C76C3BC00B7221C /* LaunchScreen.storyboard */ = { 190 | isa = PBXVariantGroup; 191 | children = ( 192 | 9213F3FC1C76C3BC00B7221C /* Base */, 193 | ); 194 | name = LaunchScreen.storyboard; 195 | sourceTree = ""; 196 | }; 197 | /* End PBXVariantGroup section */ 198 | 199 | /* Begin XCBuildConfiguration section */ 200 | 9213F3FF1C76C3BC00B7221C /* Debug */ = { 201 | isa = XCBuildConfiguration; 202 | buildSettings = { 203 | ALWAYS_SEARCH_USER_PATHS = NO; 204 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 205 | CLANG_CXX_LIBRARY = "libc++"; 206 | CLANG_ENABLE_MODULES = YES; 207 | CLANG_ENABLE_OBJC_ARC = YES; 208 | CLANG_WARN_BOOL_CONVERSION = YES; 209 | CLANG_WARN_CONSTANT_CONVERSION = YES; 210 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 211 | CLANG_WARN_EMPTY_BODY = YES; 212 | CLANG_WARN_ENUM_CONVERSION = YES; 213 | CLANG_WARN_INT_CONVERSION = YES; 214 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 215 | CLANG_WARN_UNREACHABLE_CODE = YES; 216 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 217 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 218 | COPY_PHASE_STRIP = NO; 219 | DEBUG_INFORMATION_FORMAT = dwarf; 220 | ENABLE_STRICT_OBJC_MSGSEND = YES; 221 | ENABLE_TESTABILITY = YES; 222 | GCC_C_LANGUAGE_STANDARD = gnu99; 223 | GCC_DYNAMIC_NO_PIC = NO; 224 | GCC_NO_COMMON_BLOCKS = YES; 225 | GCC_OPTIMIZATION_LEVEL = 0; 226 | GCC_PREPROCESSOR_DEFINITIONS = ( 227 | "DEBUG=1", 228 | "$(inherited)", 229 | ); 230 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 231 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 232 | GCC_WARN_UNDECLARED_SELECTOR = YES; 233 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 234 | GCC_WARN_UNUSED_FUNCTION = YES; 235 | GCC_WARN_UNUSED_VARIABLE = YES; 236 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 237 | MTL_ENABLE_DEBUG_INFO = YES; 238 | ONLY_ACTIVE_ARCH = YES; 239 | SDKROOT = iphoneos; 240 | TARGETED_DEVICE_FAMILY = "1,2"; 241 | }; 242 | name = Debug; 243 | }; 244 | 9213F4001C76C3BC00B7221C /* Release */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | ALWAYS_SEARCH_USER_PATHS = NO; 248 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 249 | CLANG_CXX_LIBRARY = "libc++"; 250 | CLANG_ENABLE_MODULES = YES; 251 | CLANG_ENABLE_OBJC_ARC = YES; 252 | CLANG_WARN_BOOL_CONVERSION = YES; 253 | CLANG_WARN_CONSTANT_CONVERSION = YES; 254 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 255 | CLANG_WARN_EMPTY_BODY = YES; 256 | CLANG_WARN_ENUM_CONVERSION = YES; 257 | CLANG_WARN_INT_CONVERSION = YES; 258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 259 | CLANG_WARN_UNREACHABLE_CODE = YES; 260 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 261 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 262 | COPY_PHASE_STRIP = NO; 263 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 264 | ENABLE_NS_ASSERTIONS = NO; 265 | ENABLE_STRICT_OBJC_MSGSEND = YES; 266 | GCC_C_LANGUAGE_STANDARD = gnu99; 267 | GCC_NO_COMMON_BLOCKS = YES; 268 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 269 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 270 | GCC_WARN_UNDECLARED_SELECTOR = YES; 271 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 272 | GCC_WARN_UNUSED_FUNCTION = YES; 273 | GCC_WARN_UNUSED_VARIABLE = YES; 274 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 275 | MTL_ENABLE_DEBUG_INFO = NO; 276 | SDKROOT = iphoneos; 277 | TARGETED_DEVICE_FAMILY = "1,2"; 278 | VALIDATE_PRODUCT = YES; 279 | }; 280 | name = Release; 281 | }; 282 | 9213F4021C76C3BC00B7221C /* Debug */ = { 283 | isa = XCBuildConfiguration; 284 | buildSettings = { 285 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 286 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 287 | GCC_PREPROCESSOR_DEFINITIONS = ( 288 | "$(inherited)", 289 | "TV_DEMO=1", 290 | ); 291 | INFOPLIST_FILE = TopmostView/Info.plist; 292 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 293 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 294 | PRODUCT_BUNDLE_IDENTIFIER = com.harrisonxi.TopmostView; 295 | PRODUCT_NAME = "$(TARGET_NAME)"; 296 | TARGETED_DEVICE_FAMILY = "1,2"; 297 | }; 298 | name = Debug; 299 | }; 300 | 9213F4031C76C3BC00B7221C /* Release */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 304 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 305 | INFOPLIST_FILE = TopmostView/Info.plist; 306 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 307 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 308 | PRODUCT_BUNDLE_IDENTIFIER = com.harrisonxi.TopmostView; 309 | PRODUCT_NAME = "$(TARGET_NAME)"; 310 | TARGETED_DEVICE_FAMILY = "1,2"; 311 | }; 312 | name = Release; 313 | }; 314 | /* End XCBuildConfiguration section */ 315 | 316 | /* Begin XCConfigurationList section */ 317 | 9213F3E51C76C3BC00B7221C /* Build configuration list for PBXProject "TopmostView" */ = { 318 | isa = XCConfigurationList; 319 | buildConfigurations = ( 320 | 9213F3FF1C76C3BC00B7221C /* Debug */, 321 | 9213F4001C76C3BC00B7221C /* Release */, 322 | ); 323 | defaultConfigurationIsVisible = 0; 324 | defaultConfigurationName = Release; 325 | }; 326 | 9213F4011C76C3BC00B7221C /* Build configuration list for PBXNativeTarget "TopmostView" */ = { 327 | isa = XCConfigurationList; 328 | buildConfigurations = ( 329 | 9213F4021C76C3BC00B7221C /* Debug */, 330 | 9213F4031C76C3BC00B7221C /* Release */, 331 | ); 332 | defaultConfigurationIsVisible = 0; 333 | defaultConfigurationName = Release; 334 | }; 335 | /* End XCConfigurationList section */ 336 | }; 337 | rootObject = 9213F3E21C76C3BC00B7221C /* Project object */; 338 | } 339 | --------------------------------------------------------------------------------