Create image with tint colour in iOS objective C

 Solution:


You cannot set the background color of an image directly.Use the below method to set the background colour of an image with red colour as like below..

UIImage *newImage = [[UIImage alloc] init];

UIGraphicsBeginImageContextWithOptions(newImage.size, NO, newImage.scale);
      UIColor *col = [UIColor redcolor];
      [col set];
      [newImage drawInRect:CGRectMake(0, 0, newImage.size.width, newImage.size.height)];
      newImage = UIGraphicsGetImageFromCurrentImageContext();
      UIGraphicsEndImageContext();

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

store cgpoint in userdefaults iOS swift