iPhone iOS will not display box-shadow properly
Try adding -webkit-appearance: none;
iOS tends to mess up forms.
Box-shadow not shown on Safari Mobile on iOS 7 (in landscape)
Adding border-radius: 1px
fixed the problem:
h1 {
box-shadow: 0 4px 9px -8px #000000;
border-radius: 1px;
color: #D95B43;
height: 1.2em;
margin-top: 0;
font-size: 1.3em;
padding: 10px;
}
From: https://stackoverflow.com/a/21323644/1565597 .
CSS Box Shadow not working on iPhone
If this in a form block, add
-webkit-appearance: none;
iPhones can mess up forms. See here.
Drop-shadow not working properly on iOS Safari
As I was playing with this I think one solution could be to use a box shadow, and apply border-radius that is using vw, for proportionality.
Something like this:
.class {
box-shadow: 6px 6px 0 #5E7735;
border-radius: 5vw; /* Or whatever fits the corners of the image used) */
}
It's a workaround but hopefully it can help someone out there!
box-shadow: inset doesn't work in iOS
It looks like this should help your problem.
It seems the main thing, is that you have your blur radius(3rd pixel value) set to 0px.
A known problem with box-shadow and older versions of safari is just that, if you have your blur raduis set to 0px, it won't work.
I hope this helps your problem.
"""Safari 6, iOS 6 and Android 2.3 default browser don't work with a 0px value for "blur-radius".
e.g. -webkit-box-shadow: 5px 1px 0px 1px #f04e29;
doesn't work, but
-webkit-box-shadow: 5px 1px 1px 1px #f04e29
does."""
This info was found at http://caniuse.com/#feat=css-boxshadow
iOS safari: (-webkit-)box-shadow on input:focus doesn't work
Use -webkit-appearance: none to override the native look:
input[type="text"]{
-webkit-appearance: none;
-webkit-box-shadow: 0 0 8px #000000;
box-shadow: 0 0 8px #000000;
}
Shadow effect is not displaying properly for UIView
Since the views may be resized you should update your shadowPath
after resizing because it has a fixed size. Unfortunately this can't be done in an extension, because you need to overwrite layoutSubview()
. But you may call addShadow()
from viewDidLayoutSubviews()
from your view controller again for each text field.
You may also modify your extension to only update the path:
extension UIView {
func addShadow() {
layer.cornerRadius = 8
layer.shadowColor = UIColor.lightGray.cgColor
layer.shadowOffset = CGSize(width: 0, height: 1.0)
layer.shadowRadius = 2.0
layer.shadowOpacity = 0.5
layer.masksToBounds = false
updateShadow()
}
func updateShadow() {
layer.shadowPath = UIBezierPath(roundedRect: self.bounds,cornerRadius:8).cgPath
}
}
With this you should call updateShadow()
from viewDidLayoutSubviews()
for each view with a shadow.
If you use a custom subclass for your text fields you may put the updateShadow()
call into layoutSubviews()
. So you need not to call it from the view controller.
Related Topics
How to Reference Instance Function When Calling Sequencetype.Foreach
What's the Equivalent of the Uisplitviewcontroller in Swiftui
How to Prevent from Scrolling Uitableview Up When Nsfetchedresultscontroller Add New Record
Error When Trying to Call Setdata(From: ) in the Cloud Firestore iOS API. How to Fix It
Could Not Find an Overload for "Init" That Accepts the Supplied Arguments in Swift
How to Get Commoncrypto/Commoncrypto File From
Firebase .Indexon Dynamic Keys
Swift - Image Data from Ciimage Qr Code/How to Render Cifilter Output
How to Fill Uitableview with a Data from Dictionary. Swift
Recursivedescription Method in Swift
How to Know That If the Only Visible Area of a .Png Is Touched in Xcode
Atos Cannot Get Symbols from Dsym of Archived Application
Uicollectionview Auto Scroll to Cell at Indexpath
Uidevice Currentdevice Model Possible Values
Uibutton in Cell in Collection View Not Receiving Touch Up Inside Event