Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 6 UIVisualEffectView in Storyboard

I am looking around the Object Library in Xcode 6 for UIVisualEffectView to add a blur in Storyboard. I know how to do this programmatically, but I can't find a way to do this in the Storyboard.

Is this unavailable in the current beta, or is there a way to do this that is not so straightforward?

like image 920
erdekhayser Avatar asked Jul 20 '14 15:07

erdekhayser


1 Answers

iOS 8.0 Gold Master UPDATE

As of the iOS 8.0 Gold Master, Xcode now has a UIVisualEffectView available in the Objects Library. To add a UIVisualEffectView to your Storyboard, just drag it from the Objects Library, position it, and then customize it using the attributes inspector.


iOS 8.0 Beta 5 and Earlier

To add a UIVisualEffectView in a Storyboard follow these steps:

  1. Create a regular, empty UIView (from the objects library)
  2. Set the custom class of the UIView to UIVisualEffectView: enter image description here
  3. Connect this new view to your code, make sure that you do not add any subviews directly to it in the Storyboard (as noted in Apple's documentation).
  4. Proceed with the programmatic setup (i.e. with the contentView).

Unfortunately, it looks like the contentView property is not an IBOutlet and therefore cannot be set in the interface (at least in this beta). Hopefully they will change that in the next beta. I filed a bug report with Apple to be able to create a UIVisualEffectView completely in Storyboards (Open Radar for rdar://17742263).


iOS 8.0 Beta 5 and Earlier - EDIT

While you are able to add a UIVisualEffectView to a Storyboard using the method described above, it is not possible to initialize that view from the Storyboard. In the current beta (iOS 8, Beta 3) these views should be created programmatically for any effect at all.

The UIVisualEffects GitHub Repo demonstrates an easy way to setup and use the new API in a variety of ways (repo is only in Swift though, no Objective-C code).

like image 164
Sam Spencer Avatar answered Nov 08 '22 05:11

Sam Spencer