1
我跟着回答这里:如何更改自定义NSTextField的大小和字体?
https://stackoverflow.com/a/3233802/3850487
我能够使用@戴夫代码,它的伟大工程。
唯一的是我似乎无法找到一种方法来更改我的标签的字体或大小。
[self.rssLabel setText:fullString];
[self.rssLabel setSpeed:0.03f];
[[self rssLabel] setFont:[NSFont boldSystemFontOfSize:100]];//NOT WORKING
什么都没有发生,就好像它没有受到影响。
我得到的最接近是当我加入一些代码来- (void)drawRect:(NSRect)dirtyRect
- (void)drawRect:(NSRect)dirtyRect {
// Drawing code here.
[[NSColor grayColor] set];//changed the background of the view
NSRectFill(dirtyRect); //not text color
...
}
我试图联系戴夫,但我不能评论呢,请指教。