iOS 7 style Blur view

You might be able to modify something like Bin Zhang’s RWBlurPopover to do this. That component uses my GPUImage to apply a Gaussian blur to components underneath it, but you could just as easily use a CIGaussianBlur for the same. GPUImage might be a hair faster though. That component relies on you being able to … Read more

How do I make UILabel display outlined text?

I was able to do it by overriding drawTextInRect: – (void)drawTextInRect:(CGRect)rect { CGSize shadowOffset = self.shadowOffset; UIColor *textColor = self.textColor; CGContextRef c = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(c, 1); CGContextSetLineJoin(c, kCGLineJoinRound); CGContextSetTextDrawingMode(c, kCGTextStroke); self.textColor = [UIColor whiteColor]; [super drawTextInRect:rect]; CGContextSetTextDrawingMode(c, kCGTextFill); self.textColor = textColor; self.shadowOffset = CGSizeMake(0, 0); [super drawTextInRect:rect]; self.shadowOffset = shadowOffset; }

How to create a colored 1×1 UIImage on the iPhone dynamically?

You can use CGContextSetFillColorWithColor and CGContextFillRect for this: Swift extension UIImage { class func image(with color: UIColor) -> UIImage { let rect = CGRectMake(0.0, 0.0, 1.0, 1.0) UIGraphicsBeginImageContext(rect.size) let context = UIGraphicsGetCurrentContext() CGContextSetFillColorWithColor(context, color.CGColor) CGContextFillRect(context, rect) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return image } } Swift3 extension UIImage { class func image(with color: UIColor) -> … Read more

to drawRect or not to drawRect (when should one use drawRect/Core Graphics vs subviews/images and why?)

Stick to UIKit and subviews whenever you can. You can be more productive, and take advantage of all the OO mechanisms that should things easier to maintain. Use Core Graphics when you can’t get the performance you need out of UIKit, or you know trying to hack together drawing effects in UIKit would be more … Read more

Get Slightly Lighter and Darker Color from UIColor

– (UIColor *)lighterColorForColor:(UIColor *)c { CGFloat r, g, b, a; if ([c getRed:&r green:&g blue:&b alpha:&a]) return [UIColor colorWithRed:MIN(r + 0.2, 1.0) green:MIN(g + 0.2, 1.0) blue:MIN(b + 0.2, 1.0) alpha:a]; return nil; } – (UIColor *)darkerColorForColor:(UIColor *)c { CGFloat r, g, b, a; if ([c getRed:&r green:&g blue:&b alpha:&a]) return [UIColor colorWithRed:MAX(r – 0.2, … Read more

How to Rotate a UIImage 90 degrees?

I believe the easiest way (and thread safe too) is to do: //assume that the image is loaded in landscape mode from disk UIImage * landscapeImage = [UIImage imageNamed:imgname]; UIImage * portraitImage = [[UIImage alloc] initWithCGImage: landscapeImage.CGImage scale: 1.0 orientation: UIImageOrientationRight]; Note: As Brainware said this only modifies the orientation data of the image – … Read more

CGContextDrawImage draws image upside down when passed UIImage.CGImage

Instead of CGContextDrawImage(context, CGRectMake(0, 0, 145, 15), image.CGImage); Use [image drawInRect:CGRectMake(0, 0, 145, 15)]; In the middle of your begin/end CGcontext methods. This will draw the image with the correct orientation into your current image context – I’m pretty sure this has something to do with the UIImage holding onto knowledge of the orientation while … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)