The simple way to do this is to render the T-Shirt image into a CGContext, then walk the rows and columns and change pixels showing a "strong" primary color to the desired tint. You would take a photo of a person wearing a bright red (or other primary color) t-shirt, then in your code only change pixels where the red color has a high luminance and saturation (i.e. the "r" value is over some threshold and the b and g components are low).
The modified image is then going to look a bit flat, as when you change the pixels to one value (the new tint) there will be no variation in luminance. To make this more realistic, you would want to make each pixel have the same luminance as it did before. You can do this by converting back and forth from RGB to a color space like HCL. Apple has a great doc on color (in the Mac section) that explains color spaces (google 'site:developer.apple.com "Color Spaces"')
To reach your goal, you will have to tackle these technologies:
- create a CGContext and render an image into it using Quartz
- figure out how to read each pixel (pixels can have alpha and different orderings)
- figure out a good way to identify the proper pixels (test by making these black or white)
- for each pixel you want to change, convert the RGB to HCL to get its luminance
- replace the pixel with a pixel of a different Color and Hue but the same Luminence
- use the CGContext to make a new image
If all this seems to difficult then you'll have to have different images for every color you want.