Comments (5)
Do you mean loading retina images from disk? I think I may have overlooked this. The disk loader doesn't check for @2x prefixes on retina devices. This is trivial to add though, so if someone doesn't beat me to it I can get this fixed this week.
- Jeff
On 2011-07-17, at 3:58 PM, [email protected] wrote:
Looking through the network image sources, I'm trying to figure out if there's already a mechanism to handle retina image scales. I got excited when I saw the scale parameters, but it looks like it's for something else, related to aspect ratios.
Is there anything special that needs to happen in order to load retina images vs. standard images when available (and the device is retina capable)?
Reply to this email directly or view it on GitHub:
#16
from nimbus.
Yeah ... Let's say I know I'm running on an iPhone 4 and have a retina display ... I could request @2x files from the server (maybe the lib would catch file not found from the response, drop the @2x appendage, and resend the file request automatically). Then set up the UIImage scale property accordingly based on what it found.
g
Sent from my iPad
On Jul 17, 2011, at 4:42 PM, [email protected] wrote:
Do you mean loading retina images from disk? I think I may have overlooked this. The disk loader doesn't check for @2x prefixes on retina devices. This is trivial to add though, so if someone doesn't beat me to it I can get this fixed this week.
- Jeff
On 2011-07-17, at 3:58 PM, [email protected] wrote:
Looking through the network image sources, I'm trying to figure out if there's already a mechanism to handle retina image scales. I got excited when I saw the scale parameters, but it looks like it's for something else, related to aspect ratios.
Is there anything special that needs to happen in order to load retina images vs. standard images when available (and the device is retina capable)?
Reply to this email directly or view it on GitHub:
#16Reply to this email directly or view it on GitHub:
#16 (comment)
from nimbus.
Ah, I see.
The way the network image view works right now, it works best for retina displays when you request images that are too large and must be scaled down. The scaling code you've probably seen here:
https://github.com/jverkoey/nimbus/blob/master/src/networkimage/src/NIHTTPImageRequest.m#L401
will create a higher resolution image from the source image on retina displays.
For example, say I'm loading a 500x500 image from the network and displaying it in a 100x100 image. On a non-retina display, the resulting image would be 100x100, but on a retina display the image would be 200x200 with a scale of 2.0.
From the sounds of it, this doesn't solve your particular use case, where you'd like to fetch a pre-created @2x image from the network. This is an interesting feature request. Given the intended use case for the network image view, I think that searching for the @2x file would be an optional feature that would be off by default, but I wouldn't be against adding it at all.
from nimbus.
Cool!
from nimbus.
I meet the similar problem
NIPhotoScrollView got problem with retina screen, the image in PhotoScrollView is smaller than in the same of iphone screen without retina.
so
-
(void)minAndMaxScaleForDimensions: (CGSize)dimensions
boundsSize: (CGSize)boundsSize
photoSize: (NIPhotoScrollViewPhotoSize)photoSize
minScale: (CGFloat *)pMinScale
maxScale: (CGFloat *)pMaxScale {
NIDASSERT(nil != pMinScale);
NIDASSERT(nil != pMaxScale);
if (nil == pMinScale
|| nil == pMaxScale) {
return;
}CGFloat minScale = [self scaleForSize: dimensions
boundsSize: boundsSize
useMinimalScale: YES];// On high resolution screens we have double the pixel density, so we will be seeing
// every pixel if we limit the maximum zoom scale to 0.5.
// If the photo size is unknown, it's likely that we're showing the loading image and
// don't want to shrink it down with the zoom because it should be a scaled image.CGFloat maxScale = ((NIPhotoScrollViewPhotoSizeUnknown == photoSize)
? 1
: (1.0f * NIScreenScale()));
I changed to (1.0f * NIScreenScale())); from (1.0f / NIScreenScale()));
Hope this can be helpful
from nimbus.
Related Issues (20)
- Three20 Migration guide link broken HOT 5
- NIQueryDictionaryFromStringUsingEncoding uses iOS 9 deprecated API HOT 2
- generate_namespace_generator filtering necessary symbols
- Migration to Swift 3
- It seems some api not fit the Swift 3...
- Use accessibilityLabel when available in NIAttributedLabel
- when can support AFNetworking3.0 HOT 1
- when can support AFNetworking3.0?
- NISwitchFormElement property attribute
- Add to Project Page is Down
- afn 3.0
- NIRuntimeClassModifications.m class utilizing method_exchangeImplementations() instead of method_setImplementation() for swizzling!
- NIAttributedLabel has more text truncation than needed after resizing.
- Test issue, please ignore
- Make Nimbus build successfully with -Wvla HOT 1
- 无法正常编译 HOT 3
- Add nullability annotations to NICollectionViewModel
- Apple generates warnings for submissions of apps that use UIWebView APIs HOT 7
- [[UIApplication sharedApplication] openURL:] causing crashes with Xcode 11 iOS 13 update
- latest tag
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nimbus.