uiwindow

AppDelegate UIWindow addSubView in different viewController

杀马特。学长 韩版系。学妹 提交于 2019-12-10 13:58:16
问题 I am trying to add a UILabel in UIWindow of AppDelegate from a UIViewController. This is how I am doing this: AppDelegate code : - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; // Override point for customization after application launch. if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { self.viewController

iOS: Programmatically creating UIWindow results in wrong position

為{幸葍}努か 提交于 2019-12-07 06:10:45
问题 In iOS 5.1.1, I have found that if I create my UIWindow (I'm tired of IB), and set its frame to [UIScreen mainScreen].bounds, the window shows up under the status bar . However if I do the same thing is iOS 6, it appears in the right spot just below the status bar. CGRect r = [[UIScreen mainScreen] bounds]; self.window = [[UIWindow alloc] initWithFrame: r]; self.detailViewController = [[DetailViewController alloc] init]; self.window.rootViewController = self.detailViewController; [self.window

How does one eliminate the rounded corners on the main window on an iPad app?

一笑奈何 提交于 2019-12-07 02:05:35
问题 I have seen some iPad apps that fill the screen (e.g. Stanza) or have squared off corners under the status bar (e.g. the iPod player has square corners at the top; can't tell at the bottom). Anyone know how this is done? It seems that, by default, the top-level UIWindow has a clipping region applied, as any subviews I place in that window get clipped off in those corners. If that is the case, is there a way to get rid of this? BTW, the clipping only seems to be there on the iPad, not on my

Get Application's main window

百般思念 提交于 2019-12-06 18:09:40
问题 UIApplication has a method keyWindow , however if an alert view is showing then this returns the window of the alert view and not the main window of the application. How can I get the app's main window? 回答1: The UIApplicationDelegate usually has a reference to the "main window": [[[UIApplication sharedApplication] delegate] window]; Furthermore, UIApplication has an array of windows [[UIApplication sharedApplication] windows] . See the UIApplication Class Reference. 回答2: I'm not 100% sure

Setting UIScreen's mode / resolution

丶灬走出姿态 提交于 2019-12-06 11:36:19
问题 I have to set the external UIScreen's mode to run with the resolution 1024x768. First I search if the screen supports this resolution: if ([[UIScreen screens] count] > 1){ CGSize size1024; size1024.height = 0; size1024.width = 0; UIScreenMode *screenMode1024 = nil; UIScreen *secondScreen = [[UIScreen screens] objectAtIndex:1]; for(int i = 0; i < [[secondScreen availableModes] count]; i++) { UIScreenMode *current = [[[[UIScreen screens] objectAtIndex:1] availableModes] objectAtIndex: i]; if

trouble with displaying another UIWindow

柔情痞子 提交于 2019-12-06 08:13:04
问题 I'm writing an iPad app, and I'm trying to display a second UIWindow on top of the main window in my app. The main thing I'm trying to do is create a log in window (how to present a login, with UISplitViewController?), and it seems that creating a second window here might be a good option. I've made a very simple app to try this out. When the user hits a button, then I'm trying to show the second window. Here's the code: - (IBAction)showOtherWindow:(id)sender { UIWindow* otherWindow = [

iPhone snapshot including keyboard

不打扰是莪最后的温柔 提交于 2019-12-06 06:27:10
问题 I'm looking for the proper way to snapshot the entire iPhone screen including the keyboard. i found some code to snapshot the screen: CGRect screenCaptureRect = [UIScreen mainScreen].bounds; UIView *viewWhereYouWantToScreenCapture = [[UIApplication sharedApplication] keyWindow]; //screen capture code UIGraphicsBeginImageContextWithOptions(screenCaptureRect.size, NO, [UIScreen mainScreen].scale); [viewWhereYouWantToScreenCapture drawViewHierarchyInRect:screenCaptureRect afterScreenUpdates:NO];

“Normal” UIButton causing obj_stack_overflow or EXC_BAD_ACCESS exception

允我心安 提交于 2019-12-06 05:19:14
问题 It sure looks innocuous enough. In my App Delegate, I check NSUserDefaults for a flag to show tips at startup. If it’s set then, at the end of applicationDidFinishLaunching: , I do this: TipsViewController *vc = [[TipsViewController alloc] initWithNibName:@“TipsView" bundle:nil]; [window addSubview:vc.view]; [vc release]; The idea is to show this view temporarily. (Note that it’s not a modal VC. No Navigation Controller at this point, plus there’s no navigation bar in this view anyway.) Once

How does one eliminate the rounded corners on the main window on an iPad app?

感情迁移 提交于 2019-12-05 07:00:18
I have seen some iPad apps that fill the screen (e.g. Stanza) or have squared off corners under the status bar (e.g. the iPod player has square corners at the top; can't tell at the bottom). Anyone know how this is done? It seems that, by default, the top-level UIWindow has a clipping region applied, as any subviews I place in that window get clipped off in those corners. If that is the case, is there a way to get rid of this? BTW, the clipping only seems to be there on the iPad, not on my iPod Touch (at least, not in the older OS version I'm running on there). Following up: I even created the

UIWindow frame in ios 8 different from ios 7 in Landscape

◇◆丶佛笑我妖孽 提交于 2019-12-05 03:06:15
I've create simple module where I add subview to UIWindow. In simulator ios 7(Xcode 5.1.1) I have printed self.windows and I get: <UIWindow: 0x8db1670; frame = (0 0; 768 1024); autoresize = W+H; gestureRecognizers = <NSArray: 0x8db1a70>; layer = <UIWindowLayer: 0x8db17d0>> but on ios8 (Xcode 6 beta 6) I get: <UIWindow: 0x794320d0; frame = (0 0; 1024 768); gestureRecognizers = <NSArray: 0x79437a80>; layer = <UIWindowLayer: 0x7943c400>> The question is: why there is a difference in frame property? fdiaz Probably in your AppDelegate you initializing your UIWindow like this self.window = [