//Create rectangle to size text fIEldNSRect textFIEldRect = NSMakeRect(300,300,54);//Instantiate text fIEld and set defaultsNSTextFIEld* textFIEld = [[NSTextFIEld alloc] initWithFrame:textFIEldRect];[textFIEld setFont:[NSFont FontWithname:@"Arial" size:48]];[textFIEld setTextcolor:[NScolor whitecolor]];[textFIEld setStringValue:@"Some Text"];[textFIEld setBackgroundcolor:[NScolor blackcolor]];[textFIEld setDrawsBackground:YES];[textFIEld setbordered:NO];[[window contentVIEw] addSubvIEw:textFIEld];解决方法 我在Mac OS X 10.6.4上尝试过你的代码.
在应用程序委托中:
- (voID)applicationDIDFinishLaunching:(NSNotification *)aNotification { NSRect textFIEldRect = NSMakeRect(300,54); NSTextFIEld* textFIEld = [[NSTextFIEld alloc] initWithFrame:textFIEldRect]; [textFIEld setFont:[NSFont FontWithname:@"Arial" size:48]]; [textFIEld setTextcolor:[NScolor whitecolor]]; [textFIEld setStringValue:@"Some Text"]; [textFIEld setBackgroundcolor:[NScolor blackcolor]]; [textFIEld setDrawsBackground:YES]; [textFIEld setbordered:NO]; [[window contentVIEw] addSubvIEw:textFIEld];}
这就是结果
alt text http://www.freeimagehosting.net/uploads/26c04b6b64.png
我看不到任何白盒子.也许你正在使用不同的 *** 作系统.或者也许你有一些其他的观点,相互引起你正在谈论的奇怪的影响.
总结以上是内存溢出为你收集整理的objective-c – NSTextField颜色问题全部内容,希望文章能够帮你解决objective-c – NSTextField颜色问题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)