加入ctrundelegate 的回调

This commit is contained in:
卢克
2013-03-19 17:19:38 +08:00
parent 6ce91b4cda
commit d823fd37c5
+19
View File
@@ -161,6 +161,25 @@ callbacks的结构体为CTRunDelegateCallbacks,主要是包含一些回调函
{% highlight objc %}
void RunDelegateDeallocCallback( void* refCon ){
}
CGFloat RunDelegateGetAscentCallback( void *refCon ){
NSString *imageName = (NSString *)refCon;
return [UIImage imageNamed:imageName].size.height;
}
CGFloat RunDelegateGetDescentCallback(void *refCon){
return 0;
}
CGFloat RunDelegateGetWidthCallback(void *refCon){
NSString *imageName = (NSString *)refCon;
return [UIImage imageNamed:imageName].size.width;
}
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();