1

Удивление, если кто-нибудь знает, как этот эффект будет достигнут. В частности, круги вокруг чисел, как вы можете видеть по кругу круга на размытом фоне позади него. И яркость сохраняется даже после того, как накладывается темная надпись на слое между цифрами и исходным фоном.iOS 7/8 Визуальный эффект экрана штрих-кода

Это экран, который отображается, когда пользователь пытается разблокировать свой iPhone.

+2

Возможно, вы могли бы включать, по крайней мере, сделать скриншот, чтобы показать, что вы спрашиваете. В противном случае, неясно, что вы описываете. –

+1

Каждый видит этот экран около 100 раз в день. Отредактировано, чтобы быть более ясным. – jln19

+1

Не все блокируют блокировку экрана сразу же при блокировке, и не каждый использует цифровой PIN-код (который, как я полагаю, вы должны говорить). Мой экран блокировки представляет собой клавиатуру, и я вижу ее только два раза в день. –

ответ

1

В прошивке 8 это может быть сделано с UIVibrancyEffect:

UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; 
UIVisualEffectView *viewWithBlurredBackground = [[UIVisualEffectView alloc] initWithEffect:effect]; 
viewWithBlurredBackground.frame = self.view.bounds; 

UIVibrancyEffect *vibrancyEffect = [UIVibrancyEffect effectForBlurEffect:effect]; 
UIVisualEffectView *viewWithVibrancy = [[UIVisualEffectView alloc] initWithEffect:vibrancyEffect]; 
viewWithVibrancy.frame = self.view.bounds; 

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 
[button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; 
button.layer.cornerRadius = 40; 
button.layer.borderWidth = 1.2; 
button.layer.borderColor = [UIColor whiteColor].CGColor; 
button.frame = CGRectMake(100, 100, 80, 80); 

[viewWithVibrancy.contentView addSubview:button]; 
[viewWithBlurredBackground.contentView addSubview:viewWithVibrancy]; 
[self.view addSubview:viewWithBlurredBackground]; 

NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc] initWithString:@"2\nA B C"]; 
[titleString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:(NSRange){0, titleString.length}]; 
[titleString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue-Thin" size:32] range:[titleString.string rangeOfString:@"2"]]; 
[titleString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue-Thin" size:10] range:[titleString.string rangeOfString:@"A B C"]]; 

// Add UILabel on top of the button, in order to avoid UIVibrancyEffect for text. 
// If you don't need it, just call [button setAttributedTitle:titleString forState:UIControlStateNormal]; 

UILabel *notVibrancyLabel = [[UILabel alloc] init]; 
notVibrancyLabel.attributedText = titleString; 
notVibrancyLabel.textAlignment = NSTextAlignmentCenter; 
notVibrancyLabel.numberOfLines = 2; 
notVibrancyLabel.frame = button.frame; 

[self.view addSubview:notVibrancyLabel]; 

Кроме того, необходимо изменить цвет фона при нажатии кнопки.

- (void)buttonPressed:(id)sender 
{ 
    UIButton *button = sender; 
    // Of course, this is just an example. Better to use subclass for this. 
    [UIView animateWithDuration:0.2 animations:^ 
    { 
     button.backgroundColor = [UIColor whiteColor]; 
    } completion:^(BOOL finished) 
    { 
     [UIView animateWithDuration:0.2 animations:^ 
     { 
      button.backgroundColor = [UIColor clearColor]; 
     }]; 
    }]; 
} 

Результат:

UIButton with UIVibrancyEffect

Смежные вопросы