ios - Integer literal overflows when stored into 'UInt' -


updated xcode 6.3 and/or swift 1.2 , getting error

integer literal overflows when stored 'uint'* pointing red dot below @ hex color 0x100114151

here code:

mybuttonoutlet.settitlecolor(uicolorfromrgb(0x100114151), forstate: uicontrolstate.normal) 

here uicolorfromrgb() method

func uicolorfromrgb(rgbvalue: uint) -> uicolor {     return uicolor(         red: cgfloat((rgbvalue & 0xff0000) >> 16) / 255.0,         green: cgfloat((rgbvalue & 0x00ff00) >> 8) / 255.0,         blue: cgfloat(rgbvalue & 0x0000ff) / 255.0,         alpha: cgfloat(1.0)     ) } 

0x100114151. okay, that's 9 hex digits. assumption: uint 32 bits on platform. works out 8 hex digits.

in other words, assigning >32-bit value variable can hold 32 bits.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -