retina-display

Checking if UIGraphicsBeginImageContextWithOptions is supported

微笑、不失礼 提交于 2019-12-01 03:57:13
问题 I'm working on an iOS app. It currently only works on iOS 4 since I use the following method on several occasions: "UIGraphicsBeginImageContextWithOptions". This method is only available in iOS 4 and therefor my app currently crashes/doesn't work on iPhone OS 3. Aside from this method there is no reason why the app should not work on iPhone OS 3. How do I make a check to see wether or not this method is available ? I've tried the following without succes: if([self respondsToSelector:@selector

Font sizes in UIWebView does NOT match iOS font size

十年热恋 提交于 2019-12-01 03:10:53
Here's a UILabel which says "About". Set at exactly 17.7 in iOS. Below it a UIWebView which also says "About". Also set at exactly 17.7 using css. They don't match. How to fix this correctly? It is bizarre that in Apple's own UIWebView, the size basis is different ? Html to test... <html><head> <style type='text/css'> body { margin: 0px; font-family: 'SourceSansPro-Light'; font-size: FONTPOINTSpt; } html { -webkit-text-size-adjust:none; } </style></head> <body leftmargin=0 topmargin=0> About </body></html> Behavior is identical on device or simulator. (Note, from here I learned the ratio is,

How to detect my iPhone app is being run on an iPad

拟墨画扇 提交于 2019-12-01 00:26:47
I have an opengl application that renders better in RetinaDisplay mode (double scale factor) and I noticed the iPad emulates an iPhone app with a low resolution screen (normal scale factor). I want to double the scale factor when my iPhone app is run on an iPad, in order to benefit from Retina Display graphics. But it seems the iPad really well fakes being an iPhone (which would be perfect if only it was a Retina Display one...) When I force the double scale, it works very well (at least in simulator, I do not have an iPad to test). So I need a way to know if I am run on an iPad despite many

MonoTouch: Doubling Appearance Image size when Hue adjusted on Retina display

旧时模样 提交于 2019-12-01 00:23:15
I am setting the NavBar's background with this code which works great in Retina and non-Retina displays. There is a @2x and normal image. So, all good: UINavigationBar.Appearance.SetBackgroundImage( GetImage(ImageTheme.menubar), UIBarMetrics.Default); Now, when I apply this ChangeHue() transformation to the image to adjust its hue, on Retina displays the image is twice the size. Non-Retina displays are fine: UINavigationBar.Appearance.SetBackgroundImage( ChangeHue(GetImage(ImageTheme.menubar)), UIBarMetrics.Default); ... UIImage ChangeHue(UIImage originalImage){ var hueAdjust = new CIHueAdjust

Simulator iPhone Retina has wrong screen resolution

爱⌒轻易说出口 提交于 2019-11-30 18:14:49
问题 I'm trying to write a Universal Application. The display should be slightly different for different screen resolutions. But when I code like this: - (void)viewDidLoad { SCREEN_WIDTH=[[UIScreen mainScreen] applicationFrame].size.width; SCREEN_HEIGHT=[[UIScreen mainScreen] applicationFrame].size.height; NSLog(@"w:%f h:%f",SCREEN_WIDTH,SCREEN_HEIGHT); ... } I get output: w:320.000000 h:480.000000 even when the simulator is set to Hardware->Device->iPhone (Retina) Furthermore, images with this

iPhone6 Display Zoom Functionality disturbs the whole view

风流意气都作罢 提交于 2019-11-30 14:33:25
I'm faces a problem with iPhone6' Display Zooms functionality, as on Xcode 6.1.1 simulator don't have Display Zoom functionality to test and its have standard display only. Problem: When I run my code on simulator and iPhone6 (with standard display) its work fine, but when I run my code on the iPhone6 (with Display Zoom functionality on) then my whole view disturbs from its original position and even UIButton are not even display or hide in this case. Here are the two images of my scenario: In the below image(iPhone 6 with standard display) all view is on its original position and everything

How should retina/normal images be handled when loading from URL?

Deadly 提交于 2019-11-30 13:27:52
问题 I understand how to programmatically load images for my app from a URL instead of packaging them within the app but how do I handle the 1x vs 2x issue? I can serve both versions from the external source if need be but how do I handle that when setting the UIImage? 回答1: I'm pretty sure you cannot load @2x image files remotely in an automated way. You will have to test for the retina display and then get the appropriate image(s), like so: UIImage *image; if ([[UIScreen mainScreen]

cocos2d iphone 5 4 inch display support

狂风中的少年 提交于 2019-11-30 12:54:25
问题 I have been looking everywhere for this but with no luck. How do I prepare my cocos2d based game for bigger 4 inch display of the iPhone 5? My app is working but i want to enhance it for the bigger 4 inch display. Cocos2d uses its own suffixes for retina display images. For retina display of the iPhone 4 and 4S it is image-hd.png . Is there a suffix for iPhone 5? How do I accomplish this? Cheers. 回答1: Add it to AppDelegate: [CCFileUtils setiPadRetinaDisplaySuffix:@"your suffix"]; [CCFileUtils

Why does iOS auto layout lead to apparent rounding errors on pre-Retina displays (unit test included)

旧时模样 提交于 2019-11-30 11:58:22
I'm currently having a hard time understanding why the following unit test fails on an iPad 2. Auto layout seems to slightly (by 0.5 points) mis-position view inside superview relative to the exact centering that's required by two layout constraints. What seems especially strange is that the crucial test (but-last assertion) passes on an iPhone 5, so the apparent rounding error affects only one (iOS 6) platform. What's going on here? UPDATE 1 I've changed the code to ensure that that both frames are sufficiently constrained in terms of widths and heights even if

Interface Builder degrades storyboards, resizes and repositions views in small increments

三世轮回 提交于 2019-11-30 10:21:28
问题 We have a number of iOS apps that several different developers contribute to. A problem that I continue to notice is that views in our storyboards will shift out of the position they were put in or resize so that they are smaller, which on labels that were sized to fit text originally becomes painfully obvious when the labels all of a sudden are truncating their text. I'm noticing these degradations of our views appear in commits to our Git repository when the developer did not directly make