IBのチェックボックスがありますが、白と青の色しか表示されません。私はどのように色を変えましたか?アウトラインビューに行の色を交互に与える方法はありますか?
2
A
答えて
1
私は
// RGB values for stripe color (light blue)
#define STRIPE_RED (237.0/255.0)
#define STRIPE_GREEN (243.0/255.0)
#define STRIPE_BLUE (254.0/255.0)
static NSColor *sStripeColor = nil;
@implementation …
// This is called after the table background is filled in,
// but before the cell contents are drawn.
// We override it so we can do our own light-blue row stripes a la iTunes.
- (void) highlightSelectionInClipRect:(NSRect)rect {
[self drawStripesInRect:rect];
[super highlightSelectionInClipRect:rect];
}
// This routine does the actual blue stripe drawing,
// filling in every other row of the table with a blue background
// so you can follow the rows easier with your eyes.
- (void) drawStripesInRect:(NSRect)clipRect {
NSRect stripeRect;
float fullRowHeight = [self rowHeight] + [self intercellSpacing].height;
float clipBottom = NSMaxY(clipRect);
int firstStripe = clipRect.origin.y/fullRowHeight;
if (firstStripe % 2 == 0)
firstStripe++; // we're only interested in drawing the stripes
// set up first rect
stripeRect.origin.x = clipRect.origin.x;
stripeRect.origin.y = firstStripe * fullRowHeight;
stripeRect.size.width = clipRect.size.width;
stripeRect.size.height = fullRowHeight;
// set the color
if (sStripeColor == nil)
sStripeColor = [[NSColor colorWithCalibratedRed:STRIPE_RED
green:STRIPE_GREEN
blue:STRIPE_BLUE
alpha:1.0] retain];
[sStripeColor set];
// and draw the stripes
while (stripeRect.origin.y < clipBottom) {
NSRectFill(stripeRect);
stripeRect.origin.y += fullRowHeight * 2.0;
}
}
、それにこのコードを発見した。しかし、私はどのようにサブクラスNSOutlineViewに知りません。 NSOutline Viewをサブクラス化する方法を教えてもらえますか?
1
関連する問題
- 1. wpfで色を交互に変えてカーブを描く方法
- 2. データグリッドに交互に行の色を表示する
- 3. BIRT:テーブルグループ内の交互の行の色
- 4. Access 2000レポート - 交互の行の色
- 5. アウトラインビューの親行だけのテキストセルの横にイメージを配置する方法はありますか?
- 6. グリッドの最初の列に色を与える方法は?
- 7. MATLABのシンボリック変数に数値を与える方法はありますか?
- 8. ローカルネームスペースの一部をインポート先に与える方法はありますか?
- 9. 色が交互になるようにJlistを生成する方法
- 10. 行の色が交互になるようなPHPコード
- 11. CSS div交互の色
- 12. NSTableViewライオンで行の色を交互に変更
- 13. 2つのベクトルを交互に織り交ぜるか、またはインターレースする
- 14. UITableViewの「バウンス領域」内の行の色を交互に続けます
- 15. テキストに色を動的に与える方法
- 16. 特定のスキーマのストアドプロシージャに実行権限を与える方法はありますか。
- 17. SQL Reporting Servicesでは、列グループの背景色が交互になるようにする方法はありますか?
- 18. 実行時にTableAttributeを設定する方法はありますか、実行時にLINQタイプの切り替えを行う方法はありますか?
- 19. ImageIconと背景色の両方をJButtonに与えるには?
- 20. SWT Tree with columns:Linux/Mac上の行の背景色を交互に削除する
- 21. MacとLinuxのQComboBoxで行の色を交互に変更する
- 22. 私のコメントシステムの背景色を交互にする
- 23. htmlテーブル内の行の色をPHPのxmlデータソースから交互に表示
- 24. HTMLの背景色を交互にするUL
- 25. ダイナミックメニューの色を交互に変更する
- 26. MySQLのTRUNCATEまたはDROP TABLEに効果的にGRANTを与える方法はありますか?
- 27. javascriptデータの変更時に行の色が交互に表示される
- 28. 異なる(交互の)高さで軸の値をプロットする方法はありますか?
- 29. `UIScrollview`でページフリップ効果を与える方法はありますか?
- 30. Flex 4のテーマを色で変える方法はありますか?
注:これは関連する質問に答えられます:http://stackoverflow.com/questions/992389/subclassing-nsoutlineview –