New in iOS 8 is a separatorEffect
property, to which you are allowed to assign a UIVisualEffect. Has anyone figured out what this is for? I've tried it and I don't see it as having any, uh, visual effect.
相关问题
- Custom UITableview cell accessibility not working
- UITableViewCell layout not updating until cell is
- Showing a checkmark accessory view move the table
- Setting the inputAccessoryView of a UITextField to
- How to put ActivityIndicator inside UIImage inside
相关文章
- UITableView dragging distance with UIRefreshContro
- Popover segue to static cell UITableView causes co
- TransitionFromView removes previous view
- ios7 new pan gesture to go back in navigation stac
- Navigation bar disappears when typing in UISearchC
- Inserting row and deleting row simultaneously. UIT
- Swift Change the tableviewcell border color accord
- iOS 8 Today widget alignment issue
As both answers have said, the only effect this is intended for is a vibrancy effect when the background of the table is a blur effect. The difference with and without the effect can be subtle:
I was wondering the exact same thing so I put a Github project together for anyone facing the same issue.
The basic idea is that if your tableView's backgroundView consists of a
UIVisualEffectView
with a blur effect, then setting theseperatorEffect
to a Vibrant Effect with the same blur as theUIVisualEffectView
will produce the effect we see in Notification Center where the separators seem transparent.Something like this:
will produce a table view like this:
Start by watching session 419 from this year's WWDC: "Advanced Graphics and Animations for iOS Apps", they explain how the new visual effect classes work.
I have a UITableViewController in my app that I use as a modal popover. The parent view controller gets blurred by a UIVisualEffectView with a UIBlurEffect, while the table view separators have a UIVibrancyEffect set as effect. On my iPhone 5, it looks like this:
This is what that same view looks like if separatorEffect is nil:
You could, of course, apply a UIBlurEffect to the separators, but that would most likely just be a waste of resources.
Note: Don't actually do what I did in this example. UIVibrancyEffect is very expensive. Just applying a UIVibrancyEffect to this table view's separators caused my app to miss the 60 FPS target on an iPhone 5.
Also note that the Reduce Transparency option under the Accessibility section in Settings.app is a thing and causes UIBlurEffects to be rendered as a solid color. Always check before instancing any UIVisualEffects. Here's some keywords for you to google:
UIAccessibilityIsReduceTransparencyEnabled()
andUIAccessibilityReduceTransparencyStatusDidChangeNotification
Hope I could help you.