How to get differentiating gap between two tableview cells in a tableview? [duplicate]
This question already has an answer here:
How to add spacing between UITableViewCell
22 answers
I have tried this code but it didn't work for me:
let whiteBackgroundLayerView: UIView = UIView(frame: CGRect(x: 10 , y: 8, width: self.view.frame.size.width - 20, height: 90))
whiteBackgroundLayerView.layer.backgroundColor = CGColor(colorSpace: CGColorSpaceCreateDeviceRGB(), components: [1.0, 1.0, 1.0, 0.8])
whiteBackgroundLayerView.layer.masksToBounds = false
whiteBackgroundLayerView.layer.cornerRadius = 2.0
cell.contentView.addSubview(whiteBackgroundLayerView)
cell.contentView.sendSubviewToBack(whiteBackgroundLayerView)
I want the output be like this:
ios swift
marked as duplicate by Community♦ Nov 26 '18 at 12:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to add spacing between UITableViewCell
22 answers
I have tried this code but it didn't work for me:
let whiteBackgroundLayerView: UIView = UIView(frame: CGRect(x: 10 , y: 8, width: self.view.frame.size.width - 20, height: 90))
whiteBackgroundLayerView.layer.backgroundColor = CGColor(colorSpace: CGColorSpaceCreateDeviceRGB(), components: [1.0, 1.0, 1.0, 0.8])
whiteBackgroundLayerView.layer.masksToBounds = false
whiteBackgroundLayerView.layer.cornerRadius = 2.0
cell.contentView.addSubview(whiteBackgroundLayerView)
cell.contentView.sendSubviewToBack(whiteBackgroundLayerView)
I want the output be like this:
ios swift
marked as duplicate by Community♦ Nov 26 '18 at 12:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Again, what do you get now? Also, please tag your question appropriately. Xcode is for problems you have with your Xcode IDE.
– Rakesha Shastri
Nov 25 '18 at 9:56
add a comment |
This question already has an answer here:
How to add spacing between UITableViewCell
22 answers
I have tried this code but it didn't work for me:
let whiteBackgroundLayerView: UIView = UIView(frame: CGRect(x: 10 , y: 8, width: self.view.frame.size.width - 20, height: 90))
whiteBackgroundLayerView.layer.backgroundColor = CGColor(colorSpace: CGColorSpaceCreateDeviceRGB(), components: [1.0, 1.0, 1.0, 0.8])
whiteBackgroundLayerView.layer.masksToBounds = false
whiteBackgroundLayerView.layer.cornerRadius = 2.0
cell.contentView.addSubview(whiteBackgroundLayerView)
cell.contentView.sendSubviewToBack(whiteBackgroundLayerView)
I want the output be like this:
ios swift
This question already has an answer here:
How to add spacing between UITableViewCell
22 answers
I have tried this code but it didn't work for me:
let whiteBackgroundLayerView: UIView = UIView(frame: CGRect(x: 10 , y: 8, width: self.view.frame.size.width - 20, height: 90))
whiteBackgroundLayerView.layer.backgroundColor = CGColor(colorSpace: CGColorSpaceCreateDeviceRGB(), components: [1.0, 1.0, 1.0, 0.8])
whiteBackgroundLayerView.layer.masksToBounds = false
whiteBackgroundLayerView.layer.cornerRadius = 2.0
cell.contentView.addSubview(whiteBackgroundLayerView)
cell.contentView.sendSubviewToBack(whiteBackgroundLayerView)
I want the output be like this:
This question already has an answer here:
How to add spacing between UITableViewCell
22 answers
ios swift
ios swift
edited Nov 25 '18 at 11:20
Rakesha Shastri
7,39621435
7,39621435
asked Nov 25 '18 at 9:49
B SAI DEERAJB SAI DEERAJ
23
23
marked as duplicate by Community♦ Nov 26 '18 at 12:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Community♦ Nov 26 '18 at 12:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Again, what do you get now? Also, please tag your question appropriately. Xcode is for problems you have with your Xcode IDE.
– Rakesha Shastri
Nov 25 '18 at 9:56
add a comment |
Again, what do you get now? Also, please tag your question appropriately. Xcode is for problems you have with your Xcode IDE.
– Rakesha Shastri
Nov 25 '18 at 9:56
Again, what do you get now? Also, please tag your question appropriately. Xcode is for problems you have with your Xcode IDE.
– Rakesha Shastri
Nov 25 '18 at 9:56
Again, what do you get now? Also, please tag your question appropriately. Xcode is for problems you have with your Xcode IDE.
– Rakesha Shastri
Nov 25 '18 at 9:56
add a comment |
1 Answer
1
active
oldest
votes
In your custom cell, add the following code:
override func layoutSubviews() {
super.layoutSubviews()
contentView.frame = UIEdgeInsetsInsetRect(contentView.frame, UIEdgeInsetsMake(10, 10, 10, 10))
}
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In your custom cell, add the following code:
override func layoutSubviews() {
super.layoutSubviews()
contentView.frame = UIEdgeInsetsInsetRect(contentView.frame, UIEdgeInsetsMake(10, 10, 10, 10))
}
add a comment |
In your custom cell, add the following code:
override func layoutSubviews() {
super.layoutSubviews()
contentView.frame = UIEdgeInsetsInsetRect(contentView.frame, UIEdgeInsetsMake(10, 10, 10, 10))
}
add a comment |
In your custom cell, add the following code:
override func layoutSubviews() {
super.layoutSubviews()
contentView.frame = UIEdgeInsetsInsetRect(contentView.frame, UIEdgeInsetsMake(10, 10, 10, 10))
}
In your custom cell, add the following code:
override func layoutSubviews() {
super.layoutSubviews()
contentView.frame = UIEdgeInsetsInsetRect(contentView.frame, UIEdgeInsetsMake(10, 10, 10, 10))
}
answered Nov 25 '18 at 9:55
DamonDamon
5181419
5181419
add a comment |
add a comment |
Again, what do you get now? Also, please tag your question appropriately. Xcode is for problems you have with your Xcode IDE.
– Rakesha Shastri
Nov 25 '18 at 9:56