NSTextField の境界線 (左上隅にある小さな黒いボックス) を丸くしようとしています: http://cl.ly/image/2V2L1u3b3u0G
そこで、NSTextField をサブクラス化しました。
MYTextField.h
#import <Cocoa/Cocoa.h>
@interface HATrackCounterField : NSTextField
@end
MYTextField.m
#import "HATrackCounterField.h"
@implementation HATrackCounterField
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self) {}
return self;
}
- (void)drawRect:(NSRect)dirtyRect
{
[[NSColor blackColor] setFill];
[[NSBezierPath bezierPathWithRoundedRect:dirtyRect xRadius:3.0 yRadius:3.0] fill];
}
@end
テキストフィールドのテキストが表示されなくなりました: http://cl.ly/image/1J2W3K431C04
私はobjective-cの初心者です。これは簡単なはずなので、おそらく何か間違っているだけです...
ありがとう!
setStringValue:
注:コレクションビューでテキストを設定していますが、さまざまな時点で試してみましたが、役に立ちませんでした。