以下、転載
- (unsigned int)intFromHexString:(NSString *) hexStr { unsigned int hexInt = 0; // Create scanner NSScanner *scanner = [NSScanner scannerWithString:hexStr]; // Tell scanner to skip the # character [scanner setCharactersToBeSkipped:[NSCharacterSet characterSetWithCharactersInString:@"#"]]; // Scan hex value [scanner scanHexInt:&hexInt]; return hexInt; }
こうなる。
関連)
0 件のコメント:
コメントを投稿