Tableview Xib Shadow Swift
Here is what I am trying to do:
The screenshot is taken from Iphone:
This is my code:
cell.shadowLayerView.layer.masksToBounds = false
cell.shadowLayerView.layer.shadowOffset = CGSize(width: 0, height: 0)
cell.shadowLayerView.layer.shadowColor = UIColor.black.cgColor
cell.shadowLayerView.layer.shadowOpacity = 0.23
cell.shadowLayerView.layer.shadowRadius = 4
cell.shadowLayerView.layer.shadowPath = UIBezierPath(roundedRect: cell.shadowLayerView.bounds, cornerRadius: 2).cgPath
cell.shadowLayerView.layer.shouldRasterize = true
cell.shadowLayerView.layer.rasterizationScale = UIScreen.main.scale
cell.discriptionLbl.frame.size.width = UIScreen.main.bounds.size.width
This is my tableview xib. In original image show light gray color shadow all side(Top,Bottom,left,Right) but in taken image show all side shadow but why show extra shadow in right side and bottom side.
See Below Image:
Question: How to show same shadow from all side of the view like original image(shadow in light gray color)?
Can someone please explain to me how to solve this , i've tried to solve this issue but no results yet.
Any help would be greatly appreciated.
Thanks in advance.
ios css swift uitableview
add a comment |
Here is what I am trying to do:
The screenshot is taken from Iphone:
This is my code:
cell.shadowLayerView.layer.masksToBounds = false
cell.shadowLayerView.layer.shadowOffset = CGSize(width: 0, height: 0)
cell.shadowLayerView.layer.shadowColor = UIColor.black.cgColor
cell.shadowLayerView.layer.shadowOpacity = 0.23
cell.shadowLayerView.layer.shadowRadius = 4
cell.shadowLayerView.layer.shadowPath = UIBezierPath(roundedRect: cell.shadowLayerView.bounds, cornerRadius: 2).cgPath
cell.shadowLayerView.layer.shouldRasterize = true
cell.shadowLayerView.layer.rasterizationScale = UIScreen.main.scale
cell.discriptionLbl.frame.size.width = UIScreen.main.bounds.size.width
This is my tableview xib. In original image show light gray color shadow all side(Top,Bottom,left,Right) but in taken image show all side shadow but why show extra shadow in right side and bottom side.
See Below Image:
Question: How to show same shadow from all side of the view like original image(shadow in light gray color)?
Can someone please explain to me how to solve this , i've tried to solve this issue but no results yet.
Any help would be greatly appreciated.
Thanks in advance.
ios css swift uitableview
this link may help you to get what you want
– Muhammad Umair Gillani
Jan 1 at 13:11
2
Supplying only a link as an answer is discouraged. The link can break if the page moves. Please consider explaining the basics of the answer you are providing since we’re not here to do basic searches that the OP could do themselves.
– Magnas
Jan 1 at 13:12
set the shadow for cell contentView
– a.masri
Jan 1 at 13:33
update question please check and give me solution.
– Sam
Jan 2 at 6:30
add a comment |
Here is what I am trying to do:
The screenshot is taken from Iphone:
This is my code:
cell.shadowLayerView.layer.masksToBounds = false
cell.shadowLayerView.layer.shadowOffset = CGSize(width: 0, height: 0)
cell.shadowLayerView.layer.shadowColor = UIColor.black.cgColor
cell.shadowLayerView.layer.shadowOpacity = 0.23
cell.shadowLayerView.layer.shadowRadius = 4
cell.shadowLayerView.layer.shadowPath = UIBezierPath(roundedRect: cell.shadowLayerView.bounds, cornerRadius: 2).cgPath
cell.shadowLayerView.layer.shouldRasterize = true
cell.shadowLayerView.layer.rasterizationScale = UIScreen.main.scale
cell.discriptionLbl.frame.size.width = UIScreen.main.bounds.size.width
This is my tableview xib. In original image show light gray color shadow all side(Top,Bottom,left,Right) but in taken image show all side shadow but why show extra shadow in right side and bottom side.
See Below Image:
Question: How to show same shadow from all side of the view like original image(shadow in light gray color)?
Can someone please explain to me how to solve this , i've tried to solve this issue but no results yet.
Any help would be greatly appreciated.
Thanks in advance.
ios css swift uitableview
Here is what I am trying to do:
The screenshot is taken from Iphone:
This is my code:
cell.shadowLayerView.layer.masksToBounds = false
cell.shadowLayerView.layer.shadowOffset = CGSize(width: 0, height: 0)
cell.shadowLayerView.layer.shadowColor = UIColor.black.cgColor
cell.shadowLayerView.layer.shadowOpacity = 0.23
cell.shadowLayerView.layer.shadowRadius = 4
cell.shadowLayerView.layer.shadowPath = UIBezierPath(roundedRect: cell.shadowLayerView.bounds, cornerRadius: 2).cgPath
cell.shadowLayerView.layer.shouldRasterize = true
cell.shadowLayerView.layer.rasterizationScale = UIScreen.main.scale
cell.discriptionLbl.frame.size.width = UIScreen.main.bounds.size.width
This is my tableview xib. In original image show light gray color shadow all side(Top,Bottom,left,Right) but in taken image show all side shadow but why show extra shadow in right side and bottom side.
See Below Image:
Question: How to show same shadow from all side of the view like original image(shadow in light gray color)?
Can someone please explain to me how to solve this , i've tried to solve this issue but no results yet.
Any help would be greatly appreciated.
Thanks in advance.
ios css swift uitableview
ios css swift uitableview
edited Jan 2 at 6:30
Sam
asked Jan 1 at 12:59


SamSam
655218
655218
this link may help you to get what you want
– Muhammad Umair Gillani
Jan 1 at 13:11
2
Supplying only a link as an answer is discouraged. The link can break if the page moves. Please consider explaining the basics of the answer you are providing since we’re not here to do basic searches that the OP could do themselves.
– Magnas
Jan 1 at 13:12
set the shadow for cell contentView
– a.masri
Jan 1 at 13:33
update question please check and give me solution.
– Sam
Jan 2 at 6:30
add a comment |
this link may help you to get what you want
– Muhammad Umair Gillani
Jan 1 at 13:11
2
Supplying only a link as an answer is discouraged. The link can break if the page moves. Please consider explaining the basics of the answer you are providing since we’re not here to do basic searches that the OP could do themselves.
– Magnas
Jan 1 at 13:12
set the shadow for cell contentView
– a.masri
Jan 1 at 13:33
update question please check and give me solution.
– Sam
Jan 2 at 6:30
this link may help you to get what you want
– Muhammad Umair Gillani
Jan 1 at 13:11
this link may help you to get what you want
– Muhammad Umair Gillani
Jan 1 at 13:11
2
2
Supplying only a link as an answer is discouraged. The link can break if the page moves. Please consider explaining the basics of the answer you are providing since we’re not here to do basic searches that the OP could do themselves.
– Magnas
Jan 1 at 13:12
Supplying only a link as an answer is discouraged. The link can break if the page moves. Please consider explaining the basics of the answer you are providing since we’re not here to do basic searches that the OP could do themselves.
– Magnas
Jan 1 at 13:12
set the shadow for cell contentView
– a.masri
Jan 1 at 13:33
set the shadow for cell contentView
– a.masri
Jan 1 at 13:33
update question please check and give me solution.
– Sam
Jan 2 at 6:30
update question please check and give me solution.
– Sam
Jan 2 at 6:30
add a comment |
2 Answers
2
active
oldest
votes
See the below code:
mainViewCorner.layer.shadowColor = UIColor.red.cgColor;
mainViewCorner.layer.shadowOffset = CGSize.zero //direction of shadow
mainViewCorner.layer.shadowOpacity = 1.0; // opacity for shadow
mainViewCorner.layer.shadowRadius = 0.0; //amount of shadow to blur
mainViewCorner.layer.cornerRadius = 4.0;
issue with your code was shadowOffset
. It defines the direction of your shadow. If you want shadow on all sides - it must have zero value for both width and height.
update question please check and give me solution.
– Sam
Jan 2 at 6:30
@Sam : Have you read my answer, I already explained that,shadowOffset
defines the direction for your shadow. So, if you want shadow equal in all directions, thenshadowOffset
must be CGSize.zero
– Mehul Thakkar
Jan 2 at 6:33
In what you have tried - please removeshadowPath
, As you are using shadowPath and shadowOffset both, it will get conflict
– Mehul Thakkar
Jan 2 at 6:35
Ya @Mehul you are right you solve my problem thank you very much please explain when i m trying to CGSize(width: 0.0, height: 0.0) and cgsize.zero is not same ?//
– Sam
Jan 2 at 6:38
You can see answer of Dipen in this question(Dont forget to read comments in the code he provided, otherwise it will not work): stackoverflow.com/questions/36173052/…,
– Mehul Thakkar
Jan 2 at 6:38
|
show 4 more comments
try it
myView.layer.cornerRadius = 10
let shadowPath = UIBezierPath(roundedRect: myView.bounds, cornerRadius: 10)
myView.layer.masksToBounds = false
myView.layer.shadowColor = UIColor.gray.cgColor
myView.layer.shadowOffset = CGSize(width: 0, height: 2)
myView.layer.shadowOpacity = 0.5
Or you can use Sketch Shadow
extension CALayer {
func applySketchShadow(
color: UIColor = .black,
alpha: Float = 0.5,
x: CGFloat = 0,
y: CGFloat = 2,
blur: CGFloat = 4,
spread: CGFloat = 0)
{
shadowColor = color.cgColor
shadowOpacity = alpha
shadowOffset = CGSize(width: x, height: y)
shadowRadius = blur / 2.0
if spread == 0 {
shadowPath = nil
} else {
let dx = -spread
let rect = bounds.insetBy(dx: dx, dy: dx)
shadowPath = UIBezierPath(rect: rect).cgPath
}
}
}
apply Sketch Shadow
myView.layer.cornerRadius = 10
let shadowPath = UIBezierPath(roundedRect: myView.bounds, cornerRadius: 10)
myView.layer.applySketchShadow(
color: .black,
alpha: 0.5,
x: CGFloat(0),
y: CGFloat(10),
blur: 20,
spread: 0)
myView.layer.shadowPath = shadowPath.cgPath
update question please check and give me solution.
– Sam
Jan 2 at 6:30
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53995639%2ftableview-xib-shadow-swift%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
See the below code:
mainViewCorner.layer.shadowColor = UIColor.red.cgColor;
mainViewCorner.layer.shadowOffset = CGSize.zero //direction of shadow
mainViewCorner.layer.shadowOpacity = 1.0; // opacity for shadow
mainViewCorner.layer.shadowRadius = 0.0; //amount of shadow to blur
mainViewCorner.layer.cornerRadius = 4.0;
issue with your code was shadowOffset
. It defines the direction of your shadow. If you want shadow on all sides - it must have zero value for both width and height.
update question please check and give me solution.
– Sam
Jan 2 at 6:30
@Sam : Have you read my answer, I already explained that,shadowOffset
defines the direction for your shadow. So, if you want shadow equal in all directions, thenshadowOffset
must be CGSize.zero
– Mehul Thakkar
Jan 2 at 6:33
In what you have tried - please removeshadowPath
, As you are using shadowPath and shadowOffset both, it will get conflict
– Mehul Thakkar
Jan 2 at 6:35
Ya @Mehul you are right you solve my problem thank you very much please explain when i m trying to CGSize(width: 0.0, height: 0.0) and cgsize.zero is not same ?//
– Sam
Jan 2 at 6:38
You can see answer of Dipen in this question(Dont forget to read comments in the code he provided, otherwise it will not work): stackoverflow.com/questions/36173052/…,
– Mehul Thakkar
Jan 2 at 6:38
|
show 4 more comments
See the below code:
mainViewCorner.layer.shadowColor = UIColor.red.cgColor;
mainViewCorner.layer.shadowOffset = CGSize.zero //direction of shadow
mainViewCorner.layer.shadowOpacity = 1.0; // opacity for shadow
mainViewCorner.layer.shadowRadius = 0.0; //amount of shadow to blur
mainViewCorner.layer.cornerRadius = 4.0;
issue with your code was shadowOffset
. It defines the direction of your shadow. If you want shadow on all sides - it must have zero value for both width and height.
update question please check and give me solution.
– Sam
Jan 2 at 6:30
@Sam : Have you read my answer, I already explained that,shadowOffset
defines the direction for your shadow. So, if you want shadow equal in all directions, thenshadowOffset
must be CGSize.zero
– Mehul Thakkar
Jan 2 at 6:33
In what you have tried - please removeshadowPath
, As you are using shadowPath and shadowOffset both, it will get conflict
– Mehul Thakkar
Jan 2 at 6:35
Ya @Mehul you are right you solve my problem thank you very much please explain when i m trying to CGSize(width: 0.0, height: 0.0) and cgsize.zero is not same ?//
– Sam
Jan 2 at 6:38
You can see answer of Dipen in this question(Dont forget to read comments in the code he provided, otherwise it will not work): stackoverflow.com/questions/36173052/…,
– Mehul Thakkar
Jan 2 at 6:38
|
show 4 more comments
See the below code:
mainViewCorner.layer.shadowColor = UIColor.red.cgColor;
mainViewCorner.layer.shadowOffset = CGSize.zero //direction of shadow
mainViewCorner.layer.shadowOpacity = 1.0; // opacity for shadow
mainViewCorner.layer.shadowRadius = 0.0; //amount of shadow to blur
mainViewCorner.layer.cornerRadius = 4.0;
issue with your code was shadowOffset
. It defines the direction of your shadow. If you want shadow on all sides - it must have zero value for both width and height.
See the below code:
mainViewCorner.layer.shadowColor = UIColor.red.cgColor;
mainViewCorner.layer.shadowOffset = CGSize.zero //direction of shadow
mainViewCorner.layer.shadowOpacity = 1.0; // opacity for shadow
mainViewCorner.layer.shadowRadius = 0.0; //amount of shadow to blur
mainViewCorner.layer.cornerRadius = 4.0;
issue with your code was shadowOffset
. It defines the direction of your shadow. If you want shadow on all sides - it must have zero value for both width and height.
edited Jan 2 at 6:42
answered Jan 1 at 13:33


Mehul ThakkarMehul Thakkar
9,73273764
9,73273764
update question please check and give me solution.
– Sam
Jan 2 at 6:30
@Sam : Have you read my answer, I already explained that,shadowOffset
defines the direction for your shadow. So, if you want shadow equal in all directions, thenshadowOffset
must be CGSize.zero
– Mehul Thakkar
Jan 2 at 6:33
In what you have tried - please removeshadowPath
, As you are using shadowPath and shadowOffset both, it will get conflict
– Mehul Thakkar
Jan 2 at 6:35
Ya @Mehul you are right you solve my problem thank you very much please explain when i m trying to CGSize(width: 0.0, height: 0.0) and cgsize.zero is not same ?//
– Sam
Jan 2 at 6:38
You can see answer of Dipen in this question(Dont forget to read comments in the code he provided, otherwise it will not work): stackoverflow.com/questions/36173052/…,
– Mehul Thakkar
Jan 2 at 6:38
|
show 4 more comments
update question please check and give me solution.
– Sam
Jan 2 at 6:30
@Sam : Have you read my answer, I already explained that,shadowOffset
defines the direction for your shadow. So, if you want shadow equal in all directions, thenshadowOffset
must be CGSize.zero
– Mehul Thakkar
Jan 2 at 6:33
In what you have tried - please removeshadowPath
, As you are using shadowPath and shadowOffset both, it will get conflict
– Mehul Thakkar
Jan 2 at 6:35
Ya @Mehul you are right you solve my problem thank you very much please explain when i m trying to CGSize(width: 0.0, height: 0.0) and cgsize.zero is not same ?//
– Sam
Jan 2 at 6:38
You can see answer of Dipen in this question(Dont forget to read comments in the code he provided, otherwise it will not work): stackoverflow.com/questions/36173052/…,
– Mehul Thakkar
Jan 2 at 6:38
update question please check and give me solution.
– Sam
Jan 2 at 6:30
update question please check and give me solution.
– Sam
Jan 2 at 6:30
@Sam : Have you read my answer, I already explained that,
shadowOffset
defines the direction for your shadow. So, if you want shadow equal in all directions, then shadowOffset
must be CGSize.zero– Mehul Thakkar
Jan 2 at 6:33
@Sam : Have you read my answer, I already explained that,
shadowOffset
defines the direction for your shadow. So, if you want shadow equal in all directions, then shadowOffset
must be CGSize.zero– Mehul Thakkar
Jan 2 at 6:33
In what you have tried - please remove
shadowPath
, As you are using shadowPath and shadowOffset both, it will get conflict– Mehul Thakkar
Jan 2 at 6:35
In what you have tried - please remove
shadowPath
, As you are using shadowPath and shadowOffset both, it will get conflict– Mehul Thakkar
Jan 2 at 6:35
Ya @Mehul you are right you solve my problem thank you very much please explain when i m trying to CGSize(width: 0.0, height: 0.0) and cgsize.zero is not same ?//
– Sam
Jan 2 at 6:38
Ya @Mehul you are right you solve my problem thank you very much please explain when i m trying to CGSize(width: 0.0, height: 0.0) and cgsize.zero is not same ?//
– Sam
Jan 2 at 6:38
You can see answer of Dipen in this question(Dont forget to read comments in the code he provided, otherwise it will not work): stackoverflow.com/questions/36173052/…,
– Mehul Thakkar
Jan 2 at 6:38
You can see answer of Dipen in this question(Dont forget to read comments in the code he provided, otherwise it will not work): stackoverflow.com/questions/36173052/…,
– Mehul Thakkar
Jan 2 at 6:38
|
show 4 more comments
try it
myView.layer.cornerRadius = 10
let shadowPath = UIBezierPath(roundedRect: myView.bounds, cornerRadius: 10)
myView.layer.masksToBounds = false
myView.layer.shadowColor = UIColor.gray.cgColor
myView.layer.shadowOffset = CGSize(width: 0, height: 2)
myView.layer.shadowOpacity = 0.5
Or you can use Sketch Shadow
extension CALayer {
func applySketchShadow(
color: UIColor = .black,
alpha: Float = 0.5,
x: CGFloat = 0,
y: CGFloat = 2,
blur: CGFloat = 4,
spread: CGFloat = 0)
{
shadowColor = color.cgColor
shadowOpacity = alpha
shadowOffset = CGSize(width: x, height: y)
shadowRadius = blur / 2.0
if spread == 0 {
shadowPath = nil
} else {
let dx = -spread
let rect = bounds.insetBy(dx: dx, dy: dx)
shadowPath = UIBezierPath(rect: rect).cgPath
}
}
}
apply Sketch Shadow
myView.layer.cornerRadius = 10
let shadowPath = UIBezierPath(roundedRect: myView.bounds, cornerRadius: 10)
myView.layer.applySketchShadow(
color: .black,
alpha: 0.5,
x: CGFloat(0),
y: CGFloat(10),
blur: 20,
spread: 0)
myView.layer.shadowPath = shadowPath.cgPath
update question please check and give me solution.
– Sam
Jan 2 at 6:30
add a comment |
try it
myView.layer.cornerRadius = 10
let shadowPath = UIBezierPath(roundedRect: myView.bounds, cornerRadius: 10)
myView.layer.masksToBounds = false
myView.layer.shadowColor = UIColor.gray.cgColor
myView.layer.shadowOffset = CGSize(width: 0, height: 2)
myView.layer.shadowOpacity = 0.5
Or you can use Sketch Shadow
extension CALayer {
func applySketchShadow(
color: UIColor = .black,
alpha: Float = 0.5,
x: CGFloat = 0,
y: CGFloat = 2,
blur: CGFloat = 4,
spread: CGFloat = 0)
{
shadowColor = color.cgColor
shadowOpacity = alpha
shadowOffset = CGSize(width: x, height: y)
shadowRadius = blur / 2.0
if spread == 0 {
shadowPath = nil
} else {
let dx = -spread
let rect = bounds.insetBy(dx: dx, dy: dx)
shadowPath = UIBezierPath(rect: rect).cgPath
}
}
}
apply Sketch Shadow
myView.layer.cornerRadius = 10
let shadowPath = UIBezierPath(roundedRect: myView.bounds, cornerRadius: 10)
myView.layer.applySketchShadow(
color: .black,
alpha: 0.5,
x: CGFloat(0),
y: CGFloat(10),
blur: 20,
spread: 0)
myView.layer.shadowPath = shadowPath.cgPath
update question please check and give me solution.
– Sam
Jan 2 at 6:30
add a comment |
try it
myView.layer.cornerRadius = 10
let shadowPath = UIBezierPath(roundedRect: myView.bounds, cornerRadius: 10)
myView.layer.masksToBounds = false
myView.layer.shadowColor = UIColor.gray.cgColor
myView.layer.shadowOffset = CGSize(width: 0, height: 2)
myView.layer.shadowOpacity = 0.5
Or you can use Sketch Shadow
extension CALayer {
func applySketchShadow(
color: UIColor = .black,
alpha: Float = 0.5,
x: CGFloat = 0,
y: CGFloat = 2,
blur: CGFloat = 4,
spread: CGFloat = 0)
{
shadowColor = color.cgColor
shadowOpacity = alpha
shadowOffset = CGSize(width: x, height: y)
shadowRadius = blur / 2.0
if spread == 0 {
shadowPath = nil
} else {
let dx = -spread
let rect = bounds.insetBy(dx: dx, dy: dx)
shadowPath = UIBezierPath(rect: rect).cgPath
}
}
}
apply Sketch Shadow
myView.layer.cornerRadius = 10
let shadowPath = UIBezierPath(roundedRect: myView.bounds, cornerRadius: 10)
myView.layer.applySketchShadow(
color: .black,
alpha: 0.5,
x: CGFloat(0),
y: CGFloat(10),
blur: 20,
spread: 0)
myView.layer.shadowPath = shadowPath.cgPath
try it
myView.layer.cornerRadius = 10
let shadowPath = UIBezierPath(roundedRect: myView.bounds, cornerRadius: 10)
myView.layer.masksToBounds = false
myView.layer.shadowColor = UIColor.gray.cgColor
myView.layer.shadowOffset = CGSize(width: 0, height: 2)
myView.layer.shadowOpacity = 0.5
Or you can use Sketch Shadow
extension CALayer {
func applySketchShadow(
color: UIColor = .black,
alpha: Float = 0.5,
x: CGFloat = 0,
y: CGFloat = 2,
blur: CGFloat = 4,
spread: CGFloat = 0)
{
shadowColor = color.cgColor
shadowOpacity = alpha
shadowOffset = CGSize(width: x, height: y)
shadowRadius = blur / 2.0
if spread == 0 {
shadowPath = nil
} else {
let dx = -spread
let rect = bounds.insetBy(dx: dx, dy: dx)
shadowPath = UIBezierPath(rect: rect).cgPath
}
}
}
apply Sketch Shadow
myView.layer.cornerRadius = 10
let shadowPath = UIBezierPath(roundedRect: myView.bounds, cornerRadius: 10)
myView.layer.applySketchShadow(
color: .black,
alpha: 0.5,
x: CGFloat(0),
y: CGFloat(10),
blur: 20,
spread: 0)
myView.layer.shadowPath = shadowPath.cgPath
answered Jan 1 at 13:40


a.masria.masri
1,7531721
1,7531721
update question please check and give me solution.
– Sam
Jan 2 at 6:30
add a comment |
update question please check and give me solution.
– Sam
Jan 2 at 6:30
update question please check and give me solution.
– Sam
Jan 2 at 6:30
update question please check and give me solution.
– Sam
Jan 2 at 6:30
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53995639%2ftableview-xib-shadow-swift%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
this link may help you to get what you want
– Muhammad Umair Gillani
Jan 1 at 13:11
2
Supplying only a link as an answer is discouraged. The link can break if the page moves. Please consider explaining the basics of the answer you are providing since we’re not here to do basic searches that the OP could do themselves.
– Magnas
Jan 1 at 13:12
set the shadow for cell contentView
– a.masri
Jan 1 at 13:33
update question please check and give me solution.
– Sam
Jan 2 at 6:30