uiwindow

Convert a UIView origin point to its Window coordinate system

浪尽此生 提交于 2019-11-28 20:15:09
I want to get the origin of scrollView in the window coordinate system. For Example, presently, scollView origin is (0,51). But in window coordinate system it should be 51 + 44(navigation bar height)+20(status bar height) = 115. Means in window coordinate system the scrollView.frame.origin should be (0,115). I tried with convertPoint: methods but getting (0,51) or (0,0) sometimes. Please provide a solution to this. Thanks TechZen It sounds like your not converting between the proper views. A view's frame is set to the coordinates of it's superview, not its own internal coordinates, so if you

Capturing full screenshot with status bar in iOS programmatically

…衆ロ難τιáo~ 提交于 2019-11-28 19:39:39
I am using this code to capture a screenshot and to save it to the photo album. -(void)TakeScreenshotAndSaveToPhotoAlbum { UIWindow *window = [UIApplication sharedApplication].keyWindow; if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) UIGraphicsBeginImageContextWithOptions(window.bounds.size, NO, [UIScreen mainScreen].scale); else UIGraphicsBeginImageContext(window.bounds.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(image, nil,

How to disable long touch in UIWebView?

℡╲_俬逩灬. 提交于 2019-11-28 19:17:59
I want to disable long-touch from the application. I have no control on the HTML that I am loading on my WebView. In webViewDidFinishLoad delegate I run a javascript on the loaded html page that disable the long touch. [webView stringByEvaluatingJavaScriptFromString:@"document.body.style.webkitTouchCallout='none'; document.body.style.KhtmlUserSelect='none'"]; You could try to override the following methods from the view controller : - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesMoved:(NSSet *

iOS - Get location of a view in a window?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 19:09:58
I have a UIView that displays a popup after it's been clicked. The popup needs to be added to the main UIWindow to make sure that it goes on top of everything else. I want the position of this popup to be relative to my UIView, so I need to know the relative location of my UIView in the window. Question: How can I find the location of a UIView in a UIWindow when the UIView is not directly in the UIWindow (It's inside the view of my viewController)? Use can use the UIView method covertRect:toView to convert to the new co-ordinate space. I did something very similar: // Convert the co-ordinates

To create a new UIWindow over the main window

好久不见. 提交于 2019-11-28 17:29:06
In my app I want to create a new UIWindow over the main UIWindow, And I wrote as following, but it don't works. first, i create a UIWindow as the main window, and then make it key and visible, and then create a new UIWindow overlay, but nothing happens. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor redColor]; ViewController *vc = [[ViewController alloc]initWithNibName:@"ViewController" bundle:nil]; self.window

iPhone - UIWindow rotating depending on current orientation?

ⅰ亾dé卋堺 提交于 2019-11-28 16:24:01
I am adding an additional UIWindow to my app. My main window rotates correctly, but this additional window I have added does not rotate. What is the best way to rotate a UIWindow according to the current device orientation? You need to roll your own for UIWindow. Listen for UIApplicationDidChangeStatusBarFrameNotification notifications, and then set the the transform when the status bar changes. You can read the current orientation from -[UIApplication statusBarOrientation] , and calculate the transform like this: #define DegreesToRadians(degrees) (degrees * M_PI / 180) - (CGAffineTransform

iOS 8 / 7 UIWindow with UIWindowLevelStatusBar Rotation issue

﹥>﹥吖頭↗ 提交于 2019-11-28 14:19:14
I'm trying to add a UIWindow with UIWindowLevelStatusBar level. it works in portrait mode on ipad perfectly but after rotating device its messed up. on iOS 7.x all rotations are fine except for upside-down, and on iOS 8.x only portrait mode is fine and all other orientations are messed up. any idea how to solve that? CGRect frame = [UIApplication sharedApplication].statusBarFrame; self.statusWindow = [[UIWindow alloc] initWithFrame:CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, 20)]; UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

Transparent iphone application

只谈情不闲聊 提交于 2019-11-28 10:38:51
问题 I'm trying to build an application that is launched has a transparent background, in practice, showing only the objects in view (buttons, labels etc etc) but not the background so you can see the background the user's home. In the example file you can see the purple square image at the center of the screen, in theory should be a normal UIView with a picture in the center but does not see the background of UIWindow/UIView. Is possible to realize such a thing? Can anyone help me? thanks 回答1: It

makeKeyWindow vs makeKeyAndVisible

江枫思渺然 提交于 2019-11-28 09:15:55
What is the difference between makeKeyWindow and makeKeyAndVisible which are two methods of UIWindow ? When will a UIWindow be a keyWindow but will not be visible? Each UIWindow has a windowLevel . A window is displayed in front of each window with a lower level, and behind each window with a higher level. But what about two windows with the same level? The window whose level was set more recently is in front, by default. (“When a window enters a new level, it’s ordered in front of all its peers in that level.”) The makeKeyWindow message makes a window key, but that window might be partially

UIWindow with wrong size when using landscape orientation

回眸只為那壹抹淺笑 提交于 2019-11-28 06:55:15
I have an empty application and there is no storyboard or xib involved. I want to have a hidden status bar and support only landscape orientation. Again, I wan't to make those changes only within code and don't touch the Info.plist. Problem I create a UIWindow with a controller that says the only supported orientation is landscape. In that case my UIWindow is created in the dimension of portrait mode and doesn't rotate. The expected result would be a screen that is completely cyan. This is my delegate: #import "AppDelegate.h" #import "AppViewController.h" @implementation AppDelegate - (BOOL