Re: Tiling, applying it in my app.
Re: Tiling, applying it in my app.
- Subject: Re: Tiling, applying it in my app.
- From: Gustavo Pizano <email@hidden>
- Date: Sat, 22 Jan 2011 20:43:15 +0100
Hi Matt.
I dunno if the following influence..
The ScrollView has a subview that at the least its size is the scrollview contetSize.. Now, inside this view Im placing, these small UIImageView in specific positions. So is not that I have a big image inside the Scroll view and I load an specific tile for the specified Zoom. This were I get confused because I really dont have (need) tiles for these small images... which the 100% size is 40px square for retina display and 20 for normal display... and as I say I did a try out with a 200% size which means I have an image 80px square @2x and a 40px for normal display. For my purposes it makes no scenes to allow the scrollview to zoom more than 3, which then at that scale I must load a 3x larger image form the original, that means 120px @2x and 60px, right?.
If I do the above just like that i have a problem, when i replace the image of each UIImageView I have on the "scene" it may happen (actually it did happen) that they will overlap each other, so thats why I scale them down modifying the transform matrix... So images remains sharp, get bigger of course because of the zoom resulting in loading bigger images and at the same time because the transformation matrix its being modified to scale them down they do not overlap..
I dunno if I made myself understand..
These is the code Im using..
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {
// after a zoom, check to see if we should change the resolution of our tiles
// [_scrollView updateResolution];
dispatch_queue_t q = dispatch_queue_create("com.softGAP.restoreHoldersRes", NULL);
dispatch_sync(q,^{
[_gridController replaceImagesOfPlaceHolderForResolution:scale];
});
dispatch_release(q);
}
-(void)replaceImagesOfPlaceHolderForResolution:(CGFloat)scale{
// int resolutionPercentage = 100 * pow(2, resolution);
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
if(scale >= 2.0){
for(HSNPlaceHolder * actualView in [self.view subviews]){
actualView.image = [UIImage imageNamed:@"placeHolder80"];
CGAffineTransform t = actualView.transform;
t.a = 0.5f;
t.d = 0.5f;
actualView.transform = t;
}
}
else {
for(HSNPlaceHolder * actualView in [self.view subviews]){
actualView.image = [UIImage imageNamed:@"placeHolder"];
CGAffineTransform t = actualView.transform;
t.a = 1.0f;
t.d = 1.0f;
actualView.transform = t;
}
}
[pool drain];
}
Thanx for the reply once again.. I hope I can clarify my doubts..
Gustavo
On Jan 22, 2011, at 7:47 PM, Matt Neuburg wrote:
>
> On Jan 22, 2011, at 10:30 AM, Gustavo Pizano wrote:
>
>> I see a Bigger image, as if it was scaled, but because in fact the image is displaying comes form a double size image there is no perceptive pixelation after the 2.0 scale
>
> The idea is that you start using the double sized image starting just above scale 1.0. That way, you are scaling the image *down*, and this always looks good. When the scale reaches above 2.0, you switch to the quadruple-sized image (if you have one). As I said, look at the Photoscroller example which shows this happening automatically (because CATiledLayer asks for a redraw automatically at those moments).
>
> Don't forget to test on a double-resolution device (or in the Simulator) because this can change some of the arithmetic. You may have to take into account both the scale of the zoom and the scale of the screen. It depends on the details of your implementation. m.
>
> --
> matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
> pantes anthropoi tou eidenai oregontai phusei
> Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
> AppleScript: the Definitive Guide, 2nd edition
> http://www.tidbits.com/matt/default.html#applescriptthings
> Take Control of Exploring & Customizing Snow Leopard
> http://tinyurl.com/kufyy8
> RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
> TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden