On tvOS, UITableView applies a nice looking gradient mask to the top and bottom of the view. In most instances this is the desired appearance, but in some cases it is not. Is there a way to conditionally turn that off? If there isn't an official way of doing this, has anyone found an indirect way of removing that effect?
You can disable it with the following:
ObjC:
self.tableView.maskView = nil;
Swift 4:
self.tableView.mask = nil
Source: How to remove UISplitViewController Master Navigation Blur Tint
Related
Our UITabBar is cutting off the bottom of our WKWebView text.
Our Storyboard view has a few labels at the top of the screen and a WKWebView set below those labels programatically. It works great but you can't scroll to the end of the WKWebView to see the last line of the text.
I believe this doesn't happen with UIWebView but that API is deprecated.
I understood automaticallyAdjustsScrollViewInsets to be the solution but apparently that doesn't work in this case.
Have tried setting Extend Edges \ Under Bottom Bars to false on the Storyboard. This comes close to solving the issue - the scrolling issue is resolved. Only issue is the Tab Bar then changes color to a darker color and I can't seem to get that to revert to the default lighter grey metallic color.
What is the correct way to do this?
WKWebView contains UIScrollView. UIScollView has contentInset property.
https://developer.apple.com/reference/uikit/uiscrollview/1619406-contentinset
Use this property to add to the scrolling area around the content. The unit of size is points. The default value is UIEdgeInsetsZero.
Figured it out based on some other SO posts:
webView.scrollView.contentInset = UIEdgeInsetsMake(0.0, 0.0, controller.tabBarController!.tabBar.frame.height, 0.0)
... maybe there is a better way (?) but this worked.
In the iOS music app, I've noticed the shadow underneath album artwork changes based on the color of the artwork. This shadow can also be multi-colored based on how the color at the edge of the artwork changes.
Does anyone know how to recreate this effect programmatically?
Thanks to #Josh Homann for pointing me in the right direction, but the answer was actually much more complex.
The first (bottom) UIView in the hierarchy should have a plain white background and be pinned to the edges of the screen.
The next view should be a UIImageView with an alpha of 0.75.
Then you should add a UIVisualEffectView with the same dimensions as the first view.
Finally, add another UIImageView that is the same size as the first UIImageView.
Your IB hierarchy should look similar to this:
The final result is this:
Its not a shadow its a UIVisualEffectView with a blur. Add a second image view under your image view with a larger size and add a blurring visualEffectView to it.
Sorry to revive an old question, but this library nailed it: ShadowImageView.
It uses CIFilter which gives you more control over the blur effect and better results.
I created a UIPickerView that I would like to not have that fade on the edges.
First I thought that must be some kind of gradient overlay so I recursively hid all UIImageViews within the UIPickerView and also set all layer.contents to nil. Setting a background color different to white to the picker view reveals that the fade cannot be an overlay, since the labels in the picker view now fade to the background color.
Does anybody have an idea on how to find that layer mask and turn it off?
EDIT
I just checked if there are any CALayers with masks, but there are none.
This is not exactly the answer to my question but at least a solution. I found a custom (horizontal) AKPickerView on GitHub which is available for Obj-C and Swift (1.2 and 2.0). This View has an undocumented property maskDisabled which does exactly what I need.
I built a custom Popoverview, but fail to remove the content's rounded corners.
Tried to set .layer.cornerRadius = 0.0 in almost every view in found, with no success.
Image Link: Custom Popover
Red border is of UIViewController used to init the UIPopoverController with, green is background of custom UIPopoverBackgroundView.
Answer from this thread: UIView default styling has rounded corners?
There is no supported way to make the view inside of your UIPopoverController not have rounded corners. The internal code of the UIPopoverController adds your view to a view with rounded corners that clips to bounds.
There may be a hackish way to do it, i.e. waiting until the UIPopoverController is shown and then traversing through all of the parent's of your view and setting them all to have cornerRadius = 0; and clipsToBounds = NO;, but even if you find a solution it might not be compatible with all versions of iOS and if Apple changes some internal code of UIPopoverController in the future then your solution could break.
If you really want to do this then the best way to go is to create your own class that mimics the UIPopoverController functionality.
I want to have a UISlider with a uniform green colour (no gradients).
When I try to paint the uislider's track it appears to have a gradient even if I put the line:
slider.backgroundColor = [UIColor clearColor];
(Second slider in the image)
When I try to put an image coloured green (in the picture is blue but ignore it...) I am not able to round the corners of the layer:
slider.layer.cornerRadius = 10;
EDIT:
I ended up customizing it UISlider custom images and thumb height?
Is it possible for me to achieve this without customising a the uislider?
Ray Wenderlich's site actually has a free tutorial about customizing UIKit components. See User Interface Customization in iOS 6.
Note that although this tutorial is titled in iOS 6, the appearance proxy is available starting in iOS 5.0, so most of this tutorial is actually relevant for iOS 5.0+.
EDIT
Unfortunately, the gradient you mentioned is actually an image that's overlaid on top of the tint color by default, and there doesn't appear to be an easy way (such as a property) to disable this.
As rmaddy suggestions in the comments though, you can simply create and use an image with rounded corners to get around this.
You can do through interface build too.Choose whatever colors or images you want to use.
Swift 4
Add this line after slider.layer.cornerRadius = 10
slider.clipsToBounds = true