Wie male ich das grüne iTunes view nach?

  • Wie male ich das grüne iTunes view nach?

    Hallo,
    ich baste gerade an einem Textfield das wie die grüne anzeige von iTunes aussehen soll,
    Und bekomms natürlich nicht so richtig hin :cursing:

    Quellcode

    1. -(void)drawWithFrame: (NSRect)frame inView: (NSView *)control
    2. {
    3. NSRect roundedFrame = frame;
    4. [NSGraphicsContext saveGraphicsState];
    5. roundedFrame.size.height--;
    6. [[NSColor darkGrayColor] setFill];
    7. NSBezierPath *path = [NSBezierPath bezierPath];
    8. [path appendBezierPathWithRoundedRect: roundedFrame xRadius: 6.0f yRadius: 6.0f];
    9. [path fill];
    10. roundedFrame.origin.y += 1;
    11. [[NSColor lightGrayColor] setFill];
    12. path = [NSBezierPath bezierPath];
    13. [path appendBezierPathWithRoundedRect: roundedFrame xRadius: 6.0f yRadius: 6.0f];
    14. [path fill];
    15. roundedFrame = NSInsetRect (roundedFrame, 1, 1);
    16. [[NSColor whiteColor] setFill];
    17. path = [NSBezierPath bezierPath];
    18. [path appendBezierPathWithRoundedRect: roundedFrame xRadius: 6.0f yRadius: 6.0f];
    19. [path fill];
    20. roundedFrame = NSInsetRect (roundedFrame, 0, 1);
    21. [[NSColor colorWithCalibratedRed: (236.0f/255.0f) green: (239.0f/255.0f) blue: (223.0f/255.0) alpha: 1.0f] setFill];
    22. path = [NSBezierPath bezierPath];
    23. [path appendBezierPathWithRoundedRect: roundedFrame xRadius: 6.0f yRadius: 6.0f];
    24. [path fill];
    25. [NSGraphicsContext restoreGraphicsState];
    26. // [self drawInteriorWithFrame: frame inView: control];
    27. }
    Alles anzeigen


    Was mache ich falsch?

    Chris
    Man macht einfach solange irgendwelche Dinge, bis man tot ist.
    Und dann bekommen die anderen Kuchen.
  • Ich denke mal mit dem grünen View meinst Du die Anzeige oben.
    Was ich mache ist das: Gradient im Hintergrund und dann die obere Hälfte mit 40% weiß nochmal übermalen.

    Wenn Du dem Bereich, in dem Du das machst, noch abgerundete Ecken hinzufügst und den Verlauf im Hintergrund recht dunkel hältst bekommst Du das hin, was ich immer Klavierlackoptik nenne.
    if (!exit(-1)) fprintf(stderr, "exit call failed. Program will continue\n");
  • seb2 schrieb:

    Ich denke mal mit dem grünen View meinst Du die Anzeige oben.
    Was ich mache ist das: Gradient im Hintergrund und dann die obere Hälfte mit 40% weiß nochmal übermalen.

    Wenn Du dem Bereich, in dem Du das machst, noch abgerundete Ecken hinzufügst und den Verlauf im Hintergrund recht dunkel hältst bekommst Du das hin, was ich immer Klavierlackoptik nenne.

    Ich habe Probleme mit dem Rand. nach letzten nächtlichen Experimenten sieht es jetzt so aus. Richtig zufrieden bin ich aber noch nicht.

    Chris
    Man macht einfach solange irgendwelche Dinge, bis man tot ist.
    Und dann bekommen die anderen Kuchen.