2014-11-27 6 views
5

크기 조정/이동은 내가 흐리게 오전있는 UIButton의 서브 클래스를 가지고 있고 그것은 멋지다 :아이폰 OS 8 UIVisualEffect UIBlurEffect 및 스케일링/

- (id)initWithFrame:(CGRect)frame 
    { 
     if (self = [super initWithFrame:frame]) 
     { 
      self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.0]; 
      UIVisualEffect *blurEffect; 
      blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; 

      UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; 
      visualEffectView.frame = self.bounds; 

      [self insertSubview:visualEffectView atIndex:0]; 
      visualEffectView.userInteractionEnabled = NO; 

      self.layer.cornerRadius = 23.8; 
      self.clipsToBounds = YES; 

      self.titleLabel.font = [UIFont fontWithName:@"DINCondensed-Bold" size:15.0]; 
     } 
     return self; 
    } 

이 버튼은, (번역)의 이동, 크기 조절, 자주 확장해야 흐림 효과가 사라질 때 반투명보기이됩니다. 이것은 CGAffineTransformation을 사용하여 프레임/센터를 사용하여 움직이는 경우 발생합니다.

치료 방법이 있습니까?

+0

사용자가 단추를 눌러 변환을 트리거합니까? – andrewbuilder

답변

1

때마다 장치가 방향을 변경하고 흐림 효과를 생성하고 제약 조건을 업데이트 할 때이를 감지하는 것이 하나의 해결책입니다.