Text getting blur on zoom-in

2019-09-16 07:23发布

I have requirement in which I have tableview as a subview of imageview. Now when the user zooms-in , the text inside the tableview is getting blur. Is there any way to manipulate it at time of zoom-in?

标签: iphone zoom
3条回答
别忘想泡老子
2楼-- · 2019-09-16 07:55

Please follow the steps which is below. Don't set the position of image statically i mean by giving coordinate.Set the position dynamically or at the run time it will take position based on current window or zoom in zoom out position label,i am not pretty much sure because i havn't faced this situation earlier but as i think it might be use case scenario for solving your problem. Thanks

查看更多
Emotional °昔
3楼-- · 2019-09-16 08:05

I have achieved it by subclassing CALayer for labels. Thanks all for help.

查看更多
迷人小祖宗
4楼-- · 2019-09-16 08:19

Subclass label as follows :

TiledLable.h file ::

#import <UIKit/UIKit.h>
#import "FastCATiledLayer.h"
@interface TiledLable : UILabel 
{

}

@end

TiledLale.m file ::

#import "TiledLable.h"
#import <QuartzCore/QuartzCore.h>

@implementation TiledLable

- (id)initWithFrame:(CGRect)frame 
{
    self = [super initWithFrame:frame];
    if (self) 
    {
        // Initialization code.
        FastCATiledLayer *tiledLayer = (FastCATiledLayer *)[self layer];
        tiledLayer.levelsOfDetail = 2;
        tiledLayer.levelsOfDetailBias = 2;
        tiledLayer.tileSize = CGSizeMake(1024.0,1024.0);
        tiledLayer.contents = nil;
        self.layer.contents = nil;
    }
    return self;
}


// Set the layer's class to be CATiledLayer.
+ (Class)layerClass 
{
    return [FastCATiledLayer class];
}

- (void)dealloc 
{
    ((CATiledLayer *)[self layer]).delegate = nil;    
    [self removeFromSuperview];
    [self.layer removeFromSuperlayer];
    [super dealloc];
}


@end
查看更多
登录 后发表回答