RVB (34, 34, 34) à UICouleur

J'ai un RVB chaîne dans le formulaire rgb(34, 34, 34). Je veux l'analyser pour un UIColor l'utilisation d'iOS. Je crois que j'ai besoin d'une regex pour cela, mais je n'arrive pas à se fissurer. C'est ce que j'ai jusqu'à présent.

NSString *regExString = @"(.*?)rgb\((\d+), (\d+), (\d+)\)";

NSError *error = nil;

NSRegularExpression *regEx = [NSRegularExpression regularExpressionWithPattern:regExString
                                                                       options:NSRegularExpressionCaseInsensitive error:&error];

NSArray *matches = [regEx matchesInString:backgroundColorString options:NSRegularExpressionCaseInsensitive
                                        range:NSMakeRange(0, backgroundColorString.length)];

Si quelqu'un pourrait m'envoyer dans la bonne direction, ce serait génial.

source d'informationauteur