Why does my UIScreen and UIWindow size not match?

I want to download a picture from the server and set it as fullscreen for the iphone4s, i use UIScreen *mainScreen = [UIScreen mainScreen]; and use this mainscreen to get the size (it's 960x640). When the app launches, I insert the code to AppDelegate .

if (im!=nil){
    UIImageView *splashScreen = [[UIImageView alloc] initWithImage:im];
    [self.window addSubview:splashScreen];
    [UIView animateWithDuration:3 animations:^{splashScreen.alpha = 0.99;}
                     completion:(void (^)(BOOL)) ^{
                         [splashScreen removeFromSuperview];
    }];
}

I noticed the size is incorrect, then I logged out the size of the self.window and found the size of the window is 320x480. How did this happen?

Here is how i get the sizes:

UIScreen *mainScreen = [UIScreen mainScreen];
UIScreenMode *ScreenMode = [mainScreen currentMode];
CGSize size = [ScreenMode size];
CGFloat screenWidth = size.width;
CGFloat screenHeight = size.height;

Answers


That's the difference between points and pixels.

The UIScreen returns the size in pixels, however UIKit deals with points. Here's some Apple documentation on the subject: https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/WindowsandViews/WindowsandViews.html#//apple_ref/doc/uid/TP40009503-CH2-SW15


Need Your Help

Collating timestamped events into date ranges with pandas

python datetime pandas

I have a master data frame with batch numbers and a datetime range for which these batches occured like so:

Apache Sling resumable upload

java file-upload download jcr sling

I wonder, is there support for resumable file upload/download in Apache Sling.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.