CTFrame: visible string range = (0, 0){type = mutable-small, count = 0, values = ()}
i find this problem only happens in ios6,and only drawing images.final,i find this code maybe the problem at :
if (imagename) {
//render empty space for drawing the image in the text //1
CTRunDelegateCallbacks callbacks;
callbacks.version = kCTRunDelegateVersion1;
callbacks.getAscent = ascentCallback;
callbacks.getDescent = descentCallback;
callbacks.getWidth = widthCallback;
callbacks.dealloc = deallocCallback;
NSDictionary *imgAttr = @{@"width": [NSNumber numberWithFloat:self.customFaceSize.width],
@"height": [NSNumber numberWithFloat:self.customFaceSize.height],
@"descent" : [NSNumber numberWithFloat:0],
};
CFRetain((__bridge CFTypeRef)imgAttr);
CTRunDelegateRef delegate = CTRunDelegateCreate(&callbacks, (__bridge void *)(imgAttr));
NSDictionary *attrDictionaryDelegate = [NSDictionary dictionaryWithObjectsAndKeys:
(__bridge id)delegate,(NSString *)kCTRunDelegateAttributeName,
imagename,iCKeyFaceName,
[NSNumber numberWithLong:styleRange.location],iCkeyFaceLocation,
nil];
[*attributedString addAttributes:attrDictionaryDelegate range:styleRange];
[*attributedString addAttributes:[self attributesWithNude:nude] range:styleRange];
}else{
[*attributedString addAttributes:[self attributesWithNude:nude] range:styleRange];
}
how can i do? thanks
i am chinese,and i solved this problem.maybe this is not u'r problem. but,i think i should make a record. and , my english is just so so !!!
ok,final i found what's the problem.Here is the step: 1.i found "CGPathAddRect" method, different rect draws different 2.so,i think CTRunDelegateRef is not the problem 3.then ,i think i should check the attributedString first 4. i compared attributedString between working and not working 5. i found in the attributedString that not working,the image run,font is 17, but woking is 13 6. so i think the attributed text font is the problem 7. then, i checked attributed styles ,i found the faceStyle font is larger than default. so,change this font to the default style font .and it works !