我用OmniGraffle Pro工具制作了我的UML类图,但是我想自动地从它的图中制作C代码.也许有人知道我怎么做到这一点?
谢谢.
我有下一个问题(下面的示例代码):
我正在使用CATextLayer
并NSAttributedString
显示风格化的文本.一切正常,直到我为属性添加笔划.当我添加笔划时 - 文本变得不可见并且在显示中我只能看到笔划.拜托,我无法理解会发生什么,为什么我不能同时使用文字和笔画?谢谢.
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) 我有下一个问题:
我有一个NSButtonCell
类的装饰器,它增加了一些功能.因为它是一个装饰器 - 是它的子类NSButtonCell
.我不喜欢创建子类,因为必须将相同的功能动态添加\删除到其他一些子类NSButtonCell
.并且,因为它是一个装饰器,我必须将所有消息转发到装饰对象,因为一些子类可以有自己的'设置',行为等.因为NSButtonCell
有很多方法,我不能编写代码将所有消息重定向到装饰对象.请告诉我,如何将所有收到的消息重定向到装饰对象?