Search Results

Search found 133 results on 6 pages for 'uiwindow'.

Page 1/6 | 1 2 3 4 5 6  | Next Page >

  • Orientation in a UIView added to a UIWindow

    - by Ken
    OK, bear with me. I have a UIView which is supposed to cover the whole device (UIWindow) to support an image zoom in/out effect I'm doing using core animation where a user taps a button on a UITableViewCell and I zoom the associated image. The zooming is performing flawlessly, what I haven't been able to figure out is why the subview is still in portrait mode even though the device is in landscape. An illustration below: http://www.weeshsoft.com/images/IMG_0482.jpg I do have a navigation controller but this view has been added to the UIWindow directly. Signed, Baffled in Atlanta

    Read the article

  • Get the UIWindow which is under the UIActionSheet

    - by Georgi
    I am trying to present a new UIViewController on top of the current current UIViewController. Here is the line of code that creates the desired effect: LoginViewController *loginViewController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil]; UIViewController *rootController = [[[UIApplication sharedApplication] keyWindow] rootViewController]; [rootController presentViewController:loginViewController animated:YES completion:nil]; The problem is that I added an UIActionSheet which asks the user to confirm the desired action (which is to log out). When the user confirms the action I run the above mentioned peace of code, but the UIActionSheet is still the keyWindow. Therefore the LoginViewController is not presented on top (the rootController is null when I try to debug). My question is: Can I somehow find the UIWindow which is under the UIActionSheet and from there get the root controller,or maybe I can dismiss programmatically the UIActionSheet when the users selects the log out action and only then execute the above code? Thank you in advance!

    Read the article

  • Using UIScreen to drive a VGA display - doesn't seem to show the UIWindow?

    - by Peter Hajas
    HI there, I'm trying to use UIScreen to drive a separate screen with the VGA dongle on my iPad. Here's what I've got in my root view controller's viewDidLoad: //Code to detect if an external display is connected to the iPad. NSLog(@"Number of screens: %d", [[UIScreen screens]count]); //Now, if there's an external screen, we need to find its modes, itereate through them and find the highest one. Once we have that mode, break out, and set the UIWindow. if([[UIScreen screens]count] > 1) //if there are more than 1 screens connected to the device { CGSize max; UIScreenMode *maxScreenMode; for(int i = 0; i < [[[[UIScreen screens] objectAtIndex:1] availableModes]count]; i++) { UIScreenMode *current = [[[[UIScreen screens]objectAtIndex:1]availableModes]objectAtIndex:i]; if(current.size.width > max.width); { max = current.size; maxScreenMode = current; } } //Now we have the highest mode. Turn the external display to use that mode. UIScreen *external = [[UIScreen screens] objectAtIndex:1]; external.currentMode = maxScreenMode; //Boom! Now the external display is set to the proper mode. We need to now set the screen of a new UIWindow to the external screen external_disp = [externalDisplay alloc]; external_disp.drawImage = drawViewController.drawImage; UIWindow *newwindow = [UIWindow alloc]; [newwindow addSubview:external_disp.view]; newwindow.screen = external; }

    Read the article

  • How to reference THE UIWindow from sub UIViewControllers?

    - by maralbjo
    I am trying to add another subview programmatically based on some event (user taps a button, for instance). My problem is that I am having problems referencing the (one and only) instance of UIWindow. I reach it from my appDelegate, because the MainWindow.xib and the appDelegate have been wired up. But I cannot reach the UIWIndow from anywhere else (I cannot draw that connection in IB, can I?) What techniwue is preferred to get a reference to (the one and only) UIWindow? ...so that I in turn can use the following code from my various UIViewControllers: [myOneAndOnlyWindow addSubview:oneOfManyViews.view]; [myOneAndOnlyWindow makeKeyAndVisible];

    Read the article

  • Doesn't [UIWindow addSubView:] retain?

    - by Dan Ray
    Check it: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSLog(@"Checking login--user value is %@", [defaults valueForKey:@"userID"]); if ([defaults valueForKey:@"userID"] == NULL){ LoginViewController *loginController = [[LoginViewController alloc] initWithNibName:@"LoginView" bundle:nil]; [window addSubview:loginController.view]; [loginController release]; } else { [window addSubview:[navigationController view]]; } Every other place when I put a subview into another view, I release that view after I've done that, because it's now owned by the view it's a subview of. HERE, though, when I do [loginController release], every IBAction on that loginController gets called against a deallocated instance. Commenting out that line makes everything work. I note the difference in approach between my loginController and the navigationController that came with the template; the navigationController is a synthesized property that gets released in -(void)dealloc{ }, so it's still around after being put into window.

    Read the article

  • How UIWindow#addSubview can make memory leak?

    - by Jakub
    Hello, I started to learn using Instrument, but I cannot figure it out. After I start my application, the UI shows up, I do nothing and after few seconds I can see memory leak detected: When I have a look at the second leak I can see the following stack: When I double click on the cell related to my code I can see that it is pointing to the following line of code: [window addSubview:newPostUIViewController.view]; from the method: - (void)applicationDidFinishLaunching:(UIApplication *)application { //creating view controller newPostUIViewController = [[NewPostUIViewController alloc] initWithNibName:@"NewPostView" bundle:nil]; newPostUIViewController.title = @"Post it!"; [window addSubview:newPostUIViewController.view]; // Override point for customization after application launch [window makeKeyAndVisible]; } I wonder, how this can be a reason of a leak? I release newPostUIViewController in the dealloc method of PostItAppDelegate class. Any ideas how this could be explained?

    Read the article

  • How can I pass a UIEvent to a UIScrollView

    - by rickharrison
    I am subclassing UIWindow and creating an implementation of sendEvent: as follows: - (void)sendEvent:(UIEvent *)event { [super sendEvent:event]; // Send event to UIScrollView here } How can I send the event to a UIScrollView. I tried calling the touchesBegan:, etc. messages, but that did not do anything.

    Read the article

  • How to provide an own UIWindow subclass as the main window in an iPhone app?

    - by mystify
    For inspecting all events posted to the views of the window, I want to make a subclass of UIWindow and make that -keyAndVisible in the app delegate. However, my project already came with an nasty MainWindow.xib file ;-) so I find it hard to do that now, since that nib guy is creating the window. Is there any way I can get rid of this MainWindow.xib? Or is there another way to have an subclass of UIWindow in place?

    Read the article

  • Automatically Sizing UIView after Adding to Window

    - by Kristopher Johnson
    I have an iPad app that switches between different views in its main window. The view-switching code looks like this: - (void)switchToViewController:(UIViewController*)viewController { if (currentViewController != viewController) { [currentViewController.view removeFromSuperview]; currentViewController = viewController; [window addSubview:viewController.view]; } } The problem is that when the new view (a UISplitView) appears in landscape orientation, it is not sized to fill the entire window. There is an empty black space on the right. If I rotate the device and then rotate back, the view sizes itself properly. If the device is in portrait orientation, everything works fine. The UISplitView also gets sized properly if it is the first view I show. The problem only occurs if I switch to it after another view has been shown, in landscape. So, is there some way to force iPhone OS to resize the view after it has been added to the window? I've tried calling sizeToFit, but it didn't work. I've also tried setting the view's bounds to the window's bounds, and I've tried setting the frame.

    Read the article

  • How does the overall view hierarchy change when using UIKit view manipulations?

    - by executor21
    I've been trying to figure out what happens in the view hierarchy when methods like pushViewController:animated, presentModalViewController:animated, and tab switches in UITabBarViewController are used, as well as UIAlertView and UIActionSheet. (Side note: I'm doing this because I need to know whether a specific UIView of my creation is visible on screen when I do not know anything about how it or its superview may have been added to the view hierarchy. If someone knows a good way to determine this, I'd welcome the knowledge.) To figure it out, I've been logging out the hierarchy of [[UIApplication sharedApplication] keyWindow] subviews in different circumstances. Is the following correct: When a new viewController is pushed onto the stack of a UINavigationController, the old viewController's view is no longer in the view hierarchy. That is, only the top view controller's view is a subview of UINavigationController's view (according to logs, it's actually several private classes such as UILayoutContainerView). Are the views of view controllers below the top controller of the stack actually removed from the window? A very similar thing happens when a new viewController is presented via presentModalViewController:animated. The new viewController's view is the only subview of the kew window. Is this correct? The easiest thing to understand: a UIAlertView creates its own window and makes it key. The strangest thing I encountered: a UIActionSheet is shown via showInView: method, the actionSheet isn't in the view hierarchy at all. It's not a subview of the view passed as an argument to showInView:, it isn't added as a subview of the key window, and it doesn't create its own window. How does it appear, then? I haven't tried this yet, so I'd like to know what happens in the keyWindow hierarchy when tabs in a UITabBarController are switched. Is the view of the selected UIViewController moved to the top, or does it work like with pushViewController:animated and presentModalViewController:animated, where only the displayed view is in the window hierarchy?

    Read the article

  • Getting x/y coordinate of a UITouch...

    - by Tarek
    HI, I have been trying to get the x/y coordinates from a touch on any iDevice. When getting the touch locations, everything looks ok if the touch is in the middle of the screen. But if I drag my finger to the bottom of the screen, I can only get a y coordinate of 1015. It should be getting to 1023. Same thing for dragging my finger to the top of the screen. I get -6. It should be 0. I have explicitly set the window and views to an origin of 0,0 and the width, height of the device's screen. Still nothing. I am really lost on what might be going on. Is something shifted? Am I not reading the x/y coordinates properly. Does something need to be transformed or converted? Any help would be much appreciated. T

    Read the article

  • UIVIewController wrong position before rotate

    - by zegnus
    I have the starter point of my application this window (white background): - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { mainScreen = [[MainScreenController alloc] initWithNibName:@"MainScreenController" bundle:[NSBundle mainBundle]]; // add it to the main window [window addSubview:[mainScreen view]]; // show view [window makeKeyAndVisible]; NSLog(@"started"); return YES; } And MainScreenController is an UIViewController with (blackBackground) created by the Interface Builder. The application executes perfectly but the first time, the black view is moved up like the height of the status iphone pannel (leaving white rectangle at the bottom). If I rotate the iPhone twice, the view is perfectly positioned in the right place, filling all the screen with the black background. Any idea? Thanks!

    Read the article

  • iPhone basic sheet programming?

    - by ryyst
    Hi, I want to program an "Add"-Window to my application, much like the "Add Contact"-window in the Contacts app or the "Add City"-window in the Weather app. My question is: how do I code the effect of sliding up that Contacts & Weather feature? -- Ry

    Read the article

  • EXC_BAD_ACCESS ( i am changing Orientation )

    - by Aishwarya
    When I put my iPhone on the table while running my application it crashes the second after I pick it up. Below is the crash log. (EXC_BAD_ACCESS) objc_msgSend -[UIWindow _shouldAutorotateToInterfaceOrientation:] -[UIWindow _updateToInterfaceOrientation:duration:force] -[UIWindow _updateInterfaceOrientationFromDeviceOrientation] -[UIWindow _handleDeviceOrientationChange:] _nsnote_callback __CFXNotificationPost _CFXNotificationPostNotification -[NSNotificationCenter postNotificationName:object:userInfo:] -[UIDevice setOrientation:] -[UIApplication handleEvent:withNewEvent:] _[UIApplication sendEvent:] _UIApplicationHandleEvent SendEvent PurpleEventTimerCallBack CFRunLoopRunSpecific CFRunLookRunInMode GSEventRunModel GSEventRun -[UIApplication _run] UIApplicationMain main Have you any idea what's the problem?

    Read the article

  • Showing/Hiding windows iPhone Dev

    - by Cal S
    In my iPhone app I am developing, I have defined two windows: @interface The_NoteAppDelegate : NSObject <UIApplicationDelegate> { IBOutlet UIWindow *newNoteWindow; IBOutlet UIWindow *homeWindow; } @property (nonatomic, retain) UIWindow *newNoteWindow; @property (nonatomic, retain) UIWindow *homeWindow; and they are linked correctly in IB - but how do I show/hide these windows? [homeWindow makeKeyAndVisible]; works in appDidFinishLaunching but when I try [newNoteWindow makeKeyAndVisible]; again to open the other window (on a button touch event) in front of the other, the app freezes. I know this is a very n00by question but please help me out :)

    Read the article

  • iOS Simulator is black on app execution

    - by Terryn
    I am running xcode 5.1.1 and have been trying to learn objective C / iOS development. Right now whenever I try to run my code on the emulator (I do not have an actual device atm) it comes up with a black screen. Code can be found here. Compiling and running gives me the following error: 2014-08-23 10:42:57.429 Calculator[1862:60b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<XYZViewController 0xe436640> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key didgetPressed.' *** First throw call stack: ( 0 CoreFoundation 0x017ed1e4 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x0156c8e5 objc_exception_throw + 44 2 CoreFoundation 0x0187cfe1 -[NSException raise] + 17 3 Foundation 0x0122cd9e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282 4 Foundation 0x011991d7 _NSSetUsingKeyValueSetter + 88 5 Foundation 0x01198731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267 6 Foundation 0x011fab0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412 7 UIKit 0x004e31f4 -[UIRuntimeOutletConnection connect] + 106 8 libobjc.A.dylib 0x0157e7de -[NSObject performSelector:] + 62 9 CoreFoundation 0x017e876a -[NSArray makeObjectsPerformSelector:] + 314 10 UIKit 0x004e1d4d -[UINib instantiateWithOwner:options:] + 1417 11 UIKit 0x0034a6f5 -[UIViewController _loadViewFromNibNamed:bundle:] + 280 12 UIKit 0x0034ae9d -[UIViewController loadView] + 302 13 UIKit 0x0034b0d3 -[UIViewController loadViewIfRequired] + 78 14 UIKit 0x0034b5d9 -[UIViewController view] + 35 15 UIKit 0x0026b267 -[UIWindow addRootViewControllerViewIfPossible] + 66 16 UIKit 0x0026b5ef -[UIWindow _setHidden:forced:] + 312 17 UIKit 0x0026b86b -[UIWindow _orderFrontWithoutMakingKey] + 49 18 UIKit 0x002763c8 -[UIWindow makeKeyAndVisible] + 65 19 UIKit 0x00226bc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097 20 UIKit 0x0022b667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824 21 UIKit 0x0023ff92 -[UIApplication handleEvent:withNewEvent:] + 3517 22 UIKit 0x00240555 -[UIApplication sendEvent:] + 85 23 UIKit 0x0022d250 _UIApplicationHandleEvent + 683 24 GraphicsServices 0x037e2f02 _PurpleEventCallback + 776 25 GraphicsServices 0x037e2a0d PurpleEventCallback + 46 26 CoreFoundation 0x01768ca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53 27 CoreFoundation 0x017689db __CFRunLoopDoSource1 + 523 28 CoreFoundation 0x0179368c __CFRunLoopRun + 2156 29 CoreFoundation 0x017929d3 CFRunLoopRunSpecific + 467 30 CoreFoundation 0x017927eb CFRunLoopRunInMode + 123 31 UIKit 0x0022ad9c -[UIApplication _run] + 840 32 UIKit 0x0022cf9b UIApplicationMain + 1225 33 Calculator 0x00002c8d main + 141 34 libdyld.dylib 0x01e34701 start + 1 35 ??? 0x00000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) I have attempted the following things, and so far nothing has worked 1) checked the deployment info, it has the main interface set to main 2) double checked all break points to turn them off and disabled all of them through Debug-Disable Breakpoints 3) Reset Content and Settings on the iOS Simulator. 4) Checked the issue with the LLDB Debugger, however from what I have read the issue is no longer present with the 5.1.1 xcode. 5) checked the local host is still set to 127.0.0.1 Thanks! - Terryn

    Read the article

  • UIView removeFromSuperView animation delay

    - by Mike
    I have a method which animates one of the subviews of UIWindow and then removes it from UIWindow using removeFromSuperview. But when I put removeFromSuperview after animation block, the animation never shows, because removeFromSuperview removes the UIView from UIWindow before the animation plays :-( How can I delay removeFromSuperview so the animation plays first, and then subview is removed? I tried [NSThread sleepForTimeInterval:1]; after animation block but that didn't have desired effect, because animation sleeps too for some reason. My code for this method: - (void) animateAndRemove { NSObject *mainWindow = [[UIApplication sharedApplication] keyWindow]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.8]; UIView *theView = nil; for (UIView *currentView in [mainWindow subviews]) { if (currentView.tag == 666) { currentView.backgroundColor = [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:0.0]; theView = currentView; } } [UIView setAnimationTransition: UIViewAnimationTransitionNone forView:theView cache:YES]; [UIView commitAnimations]; //[NSThread sleepForTimeInterval:1]; [theView removeFromSuperview]; }

    Read the article

  • iPad/iPod: autoRotate resizes view in window

    - by Jasconius
    Developing an iPad interface, I have a scenario where I have a UIViewController which manages a view that gets placed directly as a subview of the main UIWindow. Before being placed in the UIWindow, that view gets resized to a non-standard size, let's say, 768x460, and positioned at the bottom of the screen. When rotating the device, the autoRotate feature of the UIViewController causes the view to be resized so that it fills the entire UIWindow space. I thought this might be because in the XIB, the view is set to window size, but when I changed it to reflect the desired size, it still expanded it to the window size. Then I went into the MainWindow XIB and turned off autoresizeSubviews, and it still happens. This is a very frustrating problem, I am hoping that there is merely something obvious that I am missing out on. Anyone have any bright ideas?

    Read the article

  • problems programmatically creating UIView on iPad App

    - by user3871
    I have been struggling with this problem for a few days. My iPad app is designed to be a portrait game. To satisfy Apple's expection, I also support landscape mode. When it goes into landscape mode, the game goes into a letterbox format with back borders on the sides. My problem is I am creating the UIWindow and UIView programmatically. For some unkown reason, the touch controls are "locked" in to think I'm always in landscape mode. And even though visually in portrait mode everything looks correct, the top and bottom of the screen does not respond to touch. To summarize how I am setting this up, let me provide the skeletal framework of what I'm doing: in main.cpp: int retVal = UIApplicationMain(argc, argv, nil, @"derbyPoker_ipadAppDelegate"); In the delegate, I am doing this: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { CGRect screenBounds = [[UIScreen mainScreen] bounds]; CGFloat scale = [[ UIScreen mainScreen] scale ]; m_device_width = screenBounds.size.width; m_device_height = screenBounds.size.height; m_device_scale = scale; // Everything is built assuming 640x960 window = [[ UIWindow alloc ] initWithFrame:[[UIScreen mainScreen] bounds]]; viewController = [ glView new ]; [self doStateChange:[blitz class]]; return YES; } The last bit of code sets up the UIView... - (void) doStateChange: (Class) state{ viewController.view = [[state alloc] initWithFrame:CGRectMake(0, 0, m_device_width, m_device_height) andManager:self]; viewController.view.contentMode = UIViewContentModeScaleAspectFit; viewController.view.autoresizesSubviews = YES; [window addSubview:viewController.view]; [window makeKeyAndVisible]; } The problem seems to related to the line viewController.view.contentMode = UIViewContentModeScaleAspectFit; If I remove that line, touch works correctly in portrait mode. But the negative is when I'm landscape mode, the game stretches incorrectly. So That's not a option. The frustrating thing is, when I originally had this set up with a NIB file, it worked fine. I have read through the docs about UIWindow, UIViewController and UIView and have tried about everything to no avail. Any help would be greatly appreciated.

    Read the article

  • My UITabBarController's didSelectViewController method is not getting called?

    - by mobibob
    Here is my code stub for my app-delegate.m -- it never gets called. - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { NSLog(@"%s", __FUNCTION__); } It is defined in this app-delegate.h @interface OrioleAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> { UIWindow *window; UITabBarController *tabBarController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UITabBarController *tabBarController; @end

    Read the article

1 2 3 4 5 6  | Next Page >