小编Lex*_*ndr的帖子

Omnigraffle Classes图表编码

我用OmniGraffle Pro工具制作了我的UML类图,但是我想自动地从它的图中制作C代码.也许有人知道我怎么做到这一点?
谢谢.

wysiwyg uml code-generation

2
推荐指数
1
解决办法
9543
查看次数

添加笔划时,文本变为不可见

我有下一个问题(下面的示例代码):
我正在使用CATextLayerNSAttributedString显示风格化的文本.一切正常,直到我为属性添加笔划.当我添加笔划时 - 文本变得不可见并且在显示中我只能看到笔划.拜托,我无法理解会发生什么,为什么我不能同时使用文字和笔画?谢谢.

UIFont* font = [UIFont fontWithName: size:];
UIColor* strokeColor = [UIColor colorWithRed: green: blue: alpha:1.f];
UIColor* foregroundColor = [UIColor colorWithRed: green: blue: alpha:1.f];
CTFontDescriptorRef fontDescriptor = CTFontDescriptorCreateWithNameAndSize(...);
CTFontRef ctFont = CTFontCreateWithFontDescriptor(...);

NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:
                            strokeWidth, kCTStrokeWidthAttributeName,
                            [strokeColor CGColor], kCTStrokeColorAttributeName,
                            ctFont, kCTFontAttributeName,
                            [foregroundColor CGColor], kCTForegroundColorAttributeName,
                            nil];

NSAttributedString* attributedText = 
[[NSAttributedString alloc] initWithString:text attributes:attributes];

CATextLayer* infoTextLayer = [[[CATextLayer alloc] init] autorelease];
infoTextLayer.string = attributedText;
...
infoTextLayer.frame = frame;
[self.layer addSublayer:infoTextLayer];
Run Code Online (Sandbox Code Playgroud)

quartz-graphics core-text ios

1
推荐指数
1
解决办法
1188
查看次数

将所有消息转发给其他对象

我有下一个问题:
我有一个NSButtonCell类的装饰器,它增加了一些功能.因为它是一个装饰器 - 是它的子类NSButtonCell.我不喜欢创建子类,因为必须将相同的功能动态添加\删除到其他一些子类NSButtonCell.并且,因为它是一个装饰器,我必须将所有消息转发到装饰对象,因为一些子类可以有自己的'设置',行为等.因为NSButtonCell有很多方法,我不能编写代码将所有消息重定向到装饰对象.请告诉我,如何将所有收到的消息重定向到装饰对象?

cocoa objective-c objective-c-runtime

0
推荐指数
1
解决办法
238
查看次数