Search code examples
iosuiviewios7uinavigationbar

How to make translucent to UIView in iOS7


In navigation bar, i can make translucent navigation bar style. But i can not make in UIView like that. How can I make translucent style in UIView?


Solution

  • A hack would be using a UIToolBar just like you would use a normal UIView, since in iOS 7 it does the blur for you, better than any other attempts of a blur effect custom UIView. (This will only work in iOS7, for iOS 6 just add a normal alpha)

     UIToolbar *toolBar = [[UIToolBar alloc] init];
     [toolBar setFrame:kYourFrame];
     if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
          [toolBar setAlpha:0.9];
     }
     [self.view addSubview:toolBar];