How to get differentiating gap between two tableview cells in a tableview? [duplicate]












1
















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:



enter image description here










share|improve this 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


















1
















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:



enter image description here










share|improve this 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
















1












1








1









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:



enter image description here










share|improve this question

















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:



enter image description here





This question already has an answer here:




  • How to add spacing between UITableViewCell

    22 answers








ios swift






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 11:20









Rakesha Shastri

7,29721334




7,29721334










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





















  • 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














1 Answer
1






active

oldest

votes


















0














In your custom cell, add the following code:



override func layoutSubviews() {
super.layoutSubviews()
contentView.frame = UIEdgeInsetsInsetRect(contentView.frame, UIEdgeInsetsMake(10, 10, 10, 10))
}





share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    In your custom cell, add the following code:



    override func layoutSubviews() {
    super.layoutSubviews()
    contentView.frame = UIEdgeInsetsInsetRect(contentView.frame, UIEdgeInsetsMake(10, 10, 10, 10))
    }





    share|improve this answer




























      0














      In your custom cell, add the following code:



      override func layoutSubviews() {
      super.layoutSubviews()
      contentView.frame = UIEdgeInsetsInsetRect(contentView.frame, UIEdgeInsetsMake(10, 10, 10, 10))
      }





      share|improve this answer


























        0












        0








        0







        In your custom cell, add the following code:



        override func layoutSubviews() {
        super.layoutSubviews()
        contentView.frame = UIEdgeInsetsInsetRect(contentView.frame, UIEdgeInsetsMake(10, 10, 10, 10))
        }





        share|improve this answer













        In your custom cell, add the following code:



        override func layoutSubviews() {
        super.layoutSubviews()
        contentView.frame = UIEdgeInsetsInsetRect(contentView.frame, UIEdgeInsetsMake(10, 10, 10, 10))
        }






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 25 '18 at 9:55









        DamonDamon

        5181318




        5181318

















            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            TypeError: fit_transform() missing 1 required positional argument: 'X'