uiwindow

How can I show a modal view in response to a notification as a new window? (no parent vc)

爷,独闯天下 提交于 2019-12-25 04:17:09
问题 I am having a lot of issues handling my incoming local notifications. My app is using storyboards and has a tabbarcontroller as the rootviewcontroller. Currently I launch the modalviews from 'didReceiveLocalNotification' in the following manner: MedicationReminderViewController *vc = [[MedicationReminderViewController alloc] initWithNibName:@"MedicationReminderViewController" bundle:nil]; vc.notificationInfo = [[NSDictionary alloc] initWithDictionary:notification.userInfo];

UIWindow UIView addSubview issue

╄→尐↘猪︶ㄣ 提交于 2019-12-24 03:32:13
问题 Every video tutorial and book I have read displays the following code to add a UIView to the UIWindow. [window addSubview:self.viewController.view]; My understanding of the above code is that a "View" (which is an instance of a UIView) is added to the window (Which is an instance of UIWindow). Let me break it down (According to my understanding): window (UIWindow) addSubview (method to add a View to a window) Self.viewController.view (simply returns an instance of a "view" which is already

Dismiss all UIAlertControllers currently presented

纵然是瞬间 提交于 2019-12-23 20:44:51
问题 Is there a way to dismiss all UIAlertControllers that are currently presented? This is specifically because from anywhere and any state of my app, I need to get to a certain ViewController when a push notification is pressed. 回答1: You could subclass your UIAlertController s, attach NSNotification observers to each which would trigger a method within the UIAlertController subclass to dismiss the alert controller, then post an NSNotification whenever you're ready to dismiss, ex: class

Add multiple UIWindow

心已入冬 提交于 2019-12-23 20:27:42
问题 I am adding a new UIWIndow over another to display a view, but it is not showing anything and the screen just gets a little blurred. Here is the code: UIWindow* topWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; [topWindow setWindowLevel:UIWindowLevelNormal]; CGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height; UIViewController* viewController = [[UIViewController alloc] init]; UIView* overlay = [[UIView alloc] initWithFrame

Detect android webview

自作多情 提交于 2019-12-23 17:43:08
问题 I have an html-javascript page, and I need to detect whenever it open on web view (Like inside facebook webview, twitter webview, etc.), and if it a webview - display another content. Note: I do not control the third-party Android apps, so I cannot make changes to their code. I already found a way to detect an IOS webview (Found it on stackoverflow): var isIosWebview =/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent) Now I'm looking for a javascript code that can detect

UIWindow layout issue on ios7.1 with xcode 6.0

北慕城南 提交于 2019-12-23 12:13:18
问题 I created a project on xcode 6.0 and I've been running the project on ios8 simulator however when I tried run it on iphone5s ios7.1 simulator the UIWindow frame became to 320x480... self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor whiteColor]; self.window.rootViewController = self.navigationController; [self.window makeKeyAndVisible]; above is how I create UIwindow What shall I do? 回答1: You must add correct size iphone/ipad

How to add view in UIWindow?

允我心安 提交于 2019-12-21 04:18:22
问题 I wanted to add a view in UIWindow with following code: AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate; UIWindow *window = delegate.window; UIView *aView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)]; aView.backgroundColor = [UIColor blackColor]; [window addSubview:aView]; This code didn't work. I wanted to clone property of UIAlertView. It will pop over top of everything when we call [alertViewInstance show]; method. Tried this as well: UIView

How to remove a UIWindow?

让人想犯罪 __ 提交于 2019-12-20 08:57:20
问题 I thought it was easy as [myWindow resignKeyWindow] and [self.window makeKeyAndVisible] but I guess not… Would you guys know what to do? Thanks :) 回答1: Do not invoke -resignKeyWindow directly, it was meant to be overridden to execute some code when your UIWindows gets removed. In order to remove old window you need to create new instance of UIWindow and make it -makeKeyAndVisible , the old window will resign its key status. In iOS 4 it will even garbage collect your old UIWindow , provided

App crash on iPad simulator

家住魔仙堡 提交于 2019-12-20 06:48:53
问题 App works fine on iPhone device, iPhone simulator but when tested on iPad simulator it crashed and message got is [UIWindowLayer convertPoint:fromView:]: unrecognized selector sent to instance. Program received signal EXC_BAD_ACCESS on thread1 UIApplicationMain - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease]; self.containerViewController = [

UIWindow's root view controller does not rotate to landscape at app launch

吃可爱长大的小学妹 提交于 2019-12-19 04:58:47
问题 I am developing a xib-based landscape-only app. The app launches in landscape correctly. However, the view in my main ViewController is presented in portrait. That is, it is rotated 90 degrees so that the image appears cropped and does not take up the entire screen. If I use my interface to present a modal view controller then return to the main ViewController, the issue corrects itself (the view is presented in landscape). This problem did not occur under Xcode 4.2. It occurred after