UIColorBreakForOutOfRangeColorComponents Error

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • UIColorBreakForOutOfRangeColorComponents Error

    Hallo,

    ich habe versucht die Farbe des Text von einem Button wie unten beschrieben zu ändern. Allerdings erhalte ich folgenden Fehler beim Ausführen:

    Quellcode

    1. [Graphics] UIColor created with component values far outside the expected range. Set a breakpoint on UIColorBreakForOutOfRangeColorComponents to debug. This message will only be logged once.



    Probiert habe ich es mit 2 unterschiedlichen Varianten:

    1. Variante:

    Quellcode

    1. var spezialBlau = UIColor.init(red: 203.0/255.0, green: 228.0/255.0, blue: 235.0/255.0, alpha: 0.0)
    2. button.setTitleColor(spezialBlau, for: .normal)


    2. Variante:

    Quellcode

    1. var spezialBlau = UIColor.init(red: 203, green: 228, blue: 235, alpha: 0)
    2. button.setTitleColor(spezialBlau, for: .normal)


    Keine der beiden Varianten hat funktioniert. Kann mir da jemand Tipps geben was ich falsch mache? Die eingegebenen RGB Werte gibt es.




    Einen symbolic Breakpoint habe ich ebenfalls schon gesetzt aber aus dem Output werde ich nicht schlau:


    Quellcode

    1. UIKitCore`UIColorBreakForOutOfRangeColorComponents:
    2. -> 0x7fff48f40e70 <+0>: pushq %rbp
    3. 0x7fff48f40e71 <+1>: movq %rsp, %rbp
    4. 0x7fff48f40e74 <+4>: subq $0x30, %rsp
    5. 0x7fff48f40e78 <+8>: movq 0x3da0d069(%rip), %rax ; (void *)0x00007fff89dbdf50: _NSConcreteStackBlock
    6. 0x7fff48f40e7f <+15>: movq %rax, -0x28(%rbp)
    7. 0x7fff48f40e83 <+19>: movl $0xc0000000, %eax ; imm = 0xC0000000
    8. 0x7fff48f40e88 <+24>: movq %rax, -0x20(%rbp)
    9. 0x7fff48f40e8c <+28>: leaq 0x3c(%rip), %rax ; __UIColorBreakForOutOfRangeColorComponents_block_invoke
    10. 0x7fff48f40e93 <+35>: movq %rax, -0x18(%rbp)
    11. 0x7fff48f40e97 <+39>: leaq 0x3da1065a(%rip), %rax ; __block_descriptor_40_e5_v8?0l
    12. 0x7fff48f40e9e <+46>: movq %rax, -0x10(%rbp)
    13. 0x7fff48f40ea2 <+50>: leaq 0xa7e269(%rip), %rax ; "UIColorBreakForOutOfRangeColorComponents"
    14. 0x7fff48f40ea9 <+57>: movq %rax, -0x8(%rbp)
    15. 0x7fff48f40ead <+61>: cmpq $-0x1, 0x40a1e13b(%rip) ; _UIPlistSerializableClassesMinusCollections.plistSerializableClasses + 7
    16. 0x7fff48f40eb5 <+69>: jne 0x7fff48f40ebd ; <+77>
    17. 0x7fff48f40eb7 <+71>: addq $0x30, %rsp
    18. 0x7fff48f40ebb <+75>: popq %rbp
    19. 0x7fff48f40ebc <+76>: retq
    20. 0x7fff48f40ebd <+77>: leaq 0x40a1e12c(%rip), %rdi ; UIColorBreakForOutOfRangeColorComponents.once
    21. 0x7fff48f40ec4 <+84>: leaq -0x28(%rbp), %rsi
    22. 0x7fff48f40ec8 <+88>: callq 0x7fff4992887c ; symbol stub for: dispatch_once
    23. 0x7fff48f40ecd <+93>: jmp 0x7fff48f40eb7 ; <+71>
    Alles anzeigen
  • Du kannst das UIColor Objekt nach dem Erzeugen ja mal in der Console ausgeben. Da sollten Dir dann die genauen Werte angezeigt werden.

    Alternativ teste es mal mit einer Standard Color.

    Wenn der Text nicht unsichtbar sein soll, dann solltest Du einen Alpha Wert von 1.0 verwenden. ;)

    0 oder ein Wert zwischen 0 und 1 sollte jedoch nicht zu einer Fehlermeldung führen. Wobei man dies bei Apple aktuell leider nicht ausschließen kann. :(