In the iOS7 notification center, shortcuts (and separator lines) have a very interesting background: a blur image and what looks like a soft glow mode.
I'm not sure what to look for. An indicator of how this can be done will be truly appreciated.
So far, I have tried to reproduce the effect by setting part of the blurry image as the background using label.textColor = [UIColor colorWithPatternImage:...] . This also does not take into account the case when the background is completely black (or white) and leads to the fact that the text becomes unreadable.
But this does not seem to work correctly.
Like this:

Here is what I tried:
- (void)viewDidLoad { [super viewDidLoad]; const CGFloat fontSize = 25.f; const NSString *text = @"A long-ish string"; CGSize size = [text sizeWithAttributes:@{NSFontAttributeName: [UIFont fontWithName:@"Avenir Next" size:fontSize]}]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(80, 270, size.width, size.height)]; label.font = [UIFont fontWithName:@"Avenir Next" size:fontSize]; label.textAlignment = NSTextAlignmentNatural; label.backgroundColor = [UIColor clearColor]; label.text = text; UIImage *image = [UIImage imageNamed:@" wat@2x "]; UIImage *blurredImage = [image applyBlurWithRadius:20.5 tintColor:[UIColor clearColor] saturationDeltaFactor:1.f maskImage:nil]; UIImageView *imageView = [[UIImageView alloc] initWithImage:[blurredImage applyDarkEffect]]; imageView.frame = self.view.bounds; CGFloat imgScale = image.scale; CGRect labelFrame = label.frame; CGRect realRect = CGRectMake(labelFrame.origin.x * imgScale, labelFrame.origin.y * imgScale, labelFrame.size.width * imgScale, labelFrame.size.height * 2.0); CGImageRef labelPatternImage = CGImageCreateWithImageInRect(image.CGImage, realRect); label.textColor = [UIColor colorWithPatternImage:[UIImage imageWithCGImage:labelPatternImage scale:2.f orientation:UIImageOrientationUp]]; CGImageRelease(labelPatternImage); [self.view addSubview:imageView]; [self.view addSubview:label]; }
This code leads to the code Result http://caughtinflux.com/static/result.png
As you can see, this does not look like an NC label.
EDIT
The blurred background of the image for the text should match the actual background as much as possible. Hopefully a screenshot of my simulator of my code will help to understand what I'm saying.
ios objective-c quartz-core
caughtinflux
source share