func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {. add spacer cells. ) as the first subview of the view controller (at the same level as the UITableView but before it). My code:- func tableView(_ tableView: UITableView, Sep 9, 2015 · return 1. 10. Here's my code. Sometimes you don't want every cell to be the same height. Use beginUpdates and endUpdates to insert a new cell when the button clicked. override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {. Dec 1, 2023 · As you can see, in a few cells, the height for UILabel (nameLabel in my code, which is below), is much what the view need. 0. For instance this draws a shorter separator for the first three cells: override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {. count. If you want a header of your specific height pass that value: Jun 24, 2017 · 1. estimatedRowHeight = 200 And put your both Title Label and Text Label (replace Text View) in a UIView. height = 2000. Oct 12, 2016 · It’s especially easy to mess up if you’re refactoring an existing table view to use Auto Layout. Here's the code: @IBAction func myButt(_ sender: UIButton) {. To enable self-sizing table view cells, you must set the table view’s rowHeight property to 0. cellForRowAtIndexPath(indexPath) cell. Custom cells. in this case you can give tableview the bottom space 0 to its superview and it will work i think or you can do, tableView. – HangarRash. What is more, when I scroll down and get back to the top, when cells rerender by UI some cells got fixed. return [array count]; //array count returns 10. Make the background color of the cell translucent and it'll appear as though the cell has spacing above and below it May 8, 2017 · You can let every cell to take a section in group tableView, then you set the section's footer. and give constraints to UIView 1. Apr 5, 2020 · Step 3: Registering the new custom UITableViewCell with the UITableView. You can simply call tableView. append([labeltext]) Then update your table and insert a new row. You can create index paths yourself, you just need a section and row number. Then play with header heaght for the desired spacing. y: -shadowSize / 2, width: self. override func layoutSubviews() {. Jan 7, 2013 · 8. locationLabel. You could change the UIEdgeInsets with something like this. override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {. Oct 19, 2016 · In iOS, you can use Auto Layout to define the height of a table view cell; however, the feature is not enabled by default. This method allows you to set the height of each cell, effectively controlling the spacing between them. Description: Disable cell selection in a UITableView while allowing interaction with buttons inside the cell. Jan 4, 2016 · 1. deleteRows(at: [IndexPath], with: UITableView. row] return cell } How to fix it? if in . sv. You need one very handy delegate method: func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell , forRowAtIndexPath indexPath: NSIndexPath) {. Aug 3, 2017 · Then connect your button from the Storyboard by right-click + drag to your . - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger )section {. How to remove extra space after cell swift. Simply and the view in a tableFooterView for the padding in the bottom of tableView. You should fix either your question or this answer so they match. Edit: Here's the code I tried. Remove Spacing between two custom cells. CODE (some of the solutions that I tried are written below all toghether, but I also tried them one by time) func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {. row/2 somewhere, you can do the following (which involves no programming): Say for example your UITableViewCell height normally is 90 points and you want a 10 point spacing in between each cell. Before you use tableView. give fixed hight as 200 and change relation as Greater than or equal (>=) Jul 2, 2015 · To get an elements from Array in tableView cell touched or clicked in swift. 0. Select the Table View Cell and set the custom class to be MyCustomCell (the name of the class in the Swift file we added). tableView. Than you can set the cell-background to your color: Oct 7, 2018 · How can I change the space between tableview cells ios swift. If you would like to have spacing between your rows, see this supplemental example. collectionView setMinimumLineSpacing:10]; For setting space between items/cells. let buttTag = sender. storyboard and add a tableview to the view controller: The next thing we need to do is to add constraints to the tableview to make it fill most of the screen. Modified 8 years, 10 months ago. 5) cell. leastNormalMagnitude } and you will get the header spacing to 0. distribution = . let sv = UIStackView() sv. You will need to set this value to 0 in order to remove the spacing before section headings: let tableView = UITableView() tableView. iOS 15, Swift 5. First of all the iOS Settings doesn't use the ViewForSection otherwise the Section view would be placed in the top tableView. Custom class name and Identifier. func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? Oct 4, 2022 · Swift Uitableview Cell Spacing With Code Examples Hello everyone, in this post we will look at how to solve the Swift Uitableview Cell Spacing problem in the programming language. And then define headerView and its height. DisclosureIndicator. If you don't have one setup you can take a look at this tutorial. @iAnurag I added the code above. 1 on Xcode 7. I have tried . func tableView(_ tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath Apr 18, 2020 · In this video we will learn how to create a few types of custom table view cells for UITableView. avatarImageView. Objective-C or Swift; ios - How to get all Events out of a Calendar (Swift) ios - How to get height of UITableView when cells are dynamically sized? iOS iOS Swift disable UITableViewCell selection. This includes cells with switches, text fields, images, lab Aug 21, 2021 · 8. Check out this example to help get you started making your own custom cells. Automatic) //All the involved delegate methods: func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath Feb 19, 2018 · You need to add contentInset to your UITableView the first value is for top inset the second is left third for bottom and the last for right. super. Use header and footer views as visual markers for the beginning and end of sections. row])", for: . dequeueReusableCell(withIdentifier: "MyCell", for: indexPath) let button = UIButton() button. let bottom_border = CALayer() let bottom_padding = CGFloat(10. row] return cell. I'm setting the contentInset property to leave some space above the top of the content. Dynamic Cell Height. If you are looking for a way to work with table cell separator programmatically only, below is a quick example. let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView. //Add Padding in the bottom of tableview. RowAnimation) you must substrate the number of rows you want delete in numberOfRowsInSection. width, height: 20)) view. count and make each section contains only one row. Anyways, my UISearchController displayed results create a large spacing between the searchbar and tableview cells. Second thing that I would like is to add a spacing between the cell, I tried all the solutions that I found but it doesn't seem to work. Community Bot. Jan 31, 2017 · With UICollectionView, you can set the Cell's Width and Height, and add custom spacing between each cells. Also set the Identifier to be cell (the same string that we used for the cellReuseIdentifier in the code above. alt. You should use UITableView, with reusable cells, and with a UIScrollView as the sideways scroller. If you open the project you will see various cells created under the folder Cells which contain input fields Jun 21, 2018 · To add spacing between UITableViewCell you can do it like so. Dec 30, 2019 · padding didn't work since it only increased the size of the item/cell and not the spacing between, but . You could then set the footer view height to your desiered space. let bundle = Bundle(for: type(of: self)) // Register table cell class from nib. text = test[indexPath. Now that we have the completed our cell styling, we can register our custom cell with our tableview. Jan 22, 2019 · Step 3: Setup the tableView and add constraints! We add views and set constraints to them with the ViewDidLoad method. edited Aug 15, 2017 at 9:50. edited Jun 5, 2016 at 18:58. return CGFloat. automaticDimension self. Your question is for UIKit. section instead of indexPath. One easy way of doing this is as follows: In storyboard, or interface builder, add a UIView subview to the UITableviewcell. Jun 28, 2020 · You could add a UIButton to UITableViewCell by just adding it in the cellForRow method, like this:. Just return 1 in number of cells in section and your count in number of sections. 0) Aug 25, 2011 · The Best way to get space between two cells in TableView, declare the numbers of sections you want in delegate method of numberofsections this way. viewDidLoad() // That what causes the tableView to dynamicaly set the cell's height- it will work properly only if your constraints are set properly self. As @vadian said in comment, begin/endUpdates has no effect for a single insert/delete/move operation. For example you have array of 10 objects. Jun 6, 2016 · 5. let cell = tableView. deselectRow(at: indexPath, animated: true) // Handle button click or other actions as needed } More swift Examples; ios - Expanding UICollectionView and its cell when tapped; ios - reloadData() of UITableView with Dynamic cell heights causes jumpy scrolling; Select video from PhotoLibrary in iOS using Swift; ios - How to set UIButton background color forState: UIControlState. But I'm getting the following result: The content is in blue, the content inset in purple. Jan 13, 2016 · Arvindh Sukumar looks at how to create self sizing cells with UITableView and UICollectionView and Auto Layout in iOS 8 to allow for truly dynamic layouts. Other IB settings. app in Swift 2. // Inside UITableViewCell subclass. Create constraints that define your desired distance of this subview to the edges of the cell. Use the indexPath it provides to determine when you are nearing the bottom of the table. let . number of lines of label is 0. inset(by: UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8)) } By studying a variety of 10. editing or reload the cell. As long as UITableView is not the first subview of the view controller, the empty space will not appear. First of all, append data in your tableview array. If the table view is selected in interface builder and in the attributes inspector the style "Grouped" is selected, enter the following code in your view controller to fix the extra header space issue. }() But I can't add the arranged subviews to this in addition to which after I addsubview (thestack) and list all the constraints - none of my data shows in the Sep 18, 2017 · tableView. You don't have to reload the tableView. Jan 17, 2019 · I have a UITableView, with dynamic cell sizes (AutoLayout). estimatedRowHeight = 50. accessoryType = . Instead of putting all Nov 28, 2018 · override func viewDidLoad() { super. 0, *) {. contentInset = UIEdgeInsetsMake(10, 0, 0, 0) //replace 10 by your needed value Jul 13, 2020 · Sorry for the image being large I haven't posted on SO in a while. The code will look like this: private func registerTableViewCells() { let Then based on the indexPath. return 100. UITableViewCell margin left and right. Oct 30, 2016 · To achieve a TableView that looks like the one in the settings you have to set the Style of your TableView to Grouped and use Sections for separating/grouping a certain set of TableViewCells. You can return an empty containerView cell for that specific indexPath and stop didSelect in it, but remember to include the empty cells to the array you are using for other cells. All the above code is applied to this UIView. Pro tip: use Cmd+Shift+O to quickly jump between files. In your viewDidLoad () method add self. Now grab your keyboard! ⌨️. Set background color of UITableViewCell to clear color. How to add spacing between UITableViewCells - Swift. answered Jul 3, 2019 at 7:22. fillEqually. tableFooterView = UIView(); or you can do like below, The lower value should be 1. Sep 15, 2016 · I am trying to create a gap between my cells in a static UITableView. 0 self. Setting the the right constraint of your view inside the table view cell (mostly it includes giving your view proper top , bottom and traling constraints) Calling these properties of TableView in viewDidLoad () tableView. nameLabel. [self. override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return 15 } but this method does not seem to work. To add rounded corners, you can do so within awakeFromNib by setting the cornerRadius of the subview's layer property to Mar 3, 2015 · You've the right method already in there: didSelectRowAtIndexPath. tag // get the Tag of the clicked button in the Cell. frame = contentView. func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {. bgImage. frame = UIEdgeInsetsInsetRect(contentView. frame. sectionHeaderTopPadding = 0. estimatedRowHeight = 44; Jan 28, 2021 · private let settingsDelegate = SettingsTableViewDelegate() The extension would then look like this. Dec 23, 2019 · Step 2: Add the UITableView. trailing, leading, bottom and top space as ZERO 2. func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {. vertical. If so, this may be caused by the newly introduced UITableView. Then you need to implement them by yourself : If your TableView has for example 12 cells you can use 12*2-1 cells (-1 because we don't need separator for the first cell) where odd number (starting from 0) will be your custom Sep 9, 2020 · In my code when i am swiping tableview cell, the icons are looking like they are overlapping each other. The default layout for the table view cells may not be what you need. answered Sep 8, 2015 at 11:23. The first thing that we need to do is to add the tableview to our view controller. Mar 1, 2019 · Try this. What I mean is cell then space then cell then space etc. noteObjects. – random. Consider below screenshot, the red coloured view contains all the design and have top and bottom spacing with content view. In that method you can call tableView. But i want some space between these icons. // Etc. // First load table nib. row you can chose which tableView cell you want to use, like : func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell:UITableViewCell = self. tableView. To remove the line between the section header and your first cell, you should set sectionHeaderTopPadding to zero while configuring your UITableView. collectionView setMinimumInteritemSpacing:10]; Or you can (if you have) configure it directly from the Storyboard. return self. Solution: Add a hidden/clear view object (views, labels, button, etc. // Update Table Data. swift file as an @IBAction, select Type -> UIButton and click Connect. You can change the dimensions of the separator using cell. Highlighted in Swift; How to convert string to date to string ios - How to remove empty space on UITableView header after removing the header? ios - Make UITableView not scrollable and adjust height to accommodate all cells; ios - reloadData() of UITableView with Dynamic cell heights causes jumpy scrolling; ios - Change the sections header background color in UITableView using an array of headers Feb 21, 2017 · 0. May 12, 2024 · In Swift, you can set the space between cells in a UITableView by adjusting the rowHeight property of the table view's UITableViewDelegate or by implementing the heightForRowAt method of the UITableViewDelegate. I also implemented a custom view for the button styling to adjust the frame and "pressable area" of the button relative to the item/cell. override func viewDidLoad() {. size. Header and footer views are optional, and you can customize them as much or as little as you want. – Andrew Robinson. dequeueReusableCell(withIdentifier: cellReuseIdentifier) as UITableViewCell! Mar 25, 2020 · uitableview set space between cells; tableview cell animation swift; how to set the spacing of a collection view swift; swift uitableview insert cell; swift get slected row data in tableview cell; collectionview cellssize swift 4; collectionview cellssize swift 4; hstack spacing swiftui; auto layout issue in tableview; check and uncheck cells create a custom cell, add a label, then set the cell bottom padding appropriately. text = namesArray[indexPath. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView. May 28, 2015 · Dynamic sizing cell of UITableView required 2 things. tblList. if namesArray. Viewed 3k times Jul 3, 2019 · 0. You can also configure the space between the cell and the border of the CollectionView. editing = false. 425 1 5 15. // Return the number of rows in the section. For making the cell auto sizeable, you need to do two things: Bottom space and top space constraints will push the cell size as needed. Dec 1, 2018 · Let's jump straight into the coding part, but first: start Xcode, create a new iOS single view app project, enter some name & details for the project as usual, use Swift and finally open the ViewController. image = UIImage(named: "second_image") } As per default this works to change the image. 6. It will disable automatic insets on both iOS 11 and older iOS versions. count have this: Jun 26, 2015 · ChangeSchoolListTableViewCell. Also the outlet for my table view is called tableview where the video calls it myTableView. Dec 19, 2017 · There are two options here: If you snap your table view to bottom edge of navbar be sure to execute the code below. Apr 15, 2017 · I want to add space between the cells that I have in my UITableView. func numberOfSections(in collectionView: UICollectionView) -> Int {. Answer in Swift 4. // Inside UITableViewCell subclass override func layoutSubviews() { super. dequeueReusableCell(withIdentifier: "Cell") as! TableViewCell. Both UIView and UIViewController instances can be wrapped to become fully SwiftUI-compatible, and UIHostingController lets us render any SwiftUI view within a Sep 20, 2013 · 1. Feb 21, 2015 · 2. Mar 29, 2016 · I had similar issue using Xcode 8. return 1;// this should be one because it will create space between two cells if you want space between 4 Sep 8, 2015 · 1. rowHeight = UITableView. environment(. First, we will start with the UITableViewCells creation. sectionHeaderTopPadding property. Otherwise, please watch… // Replace table rows with sections by extending UITableViewDelegate // now we use indexPath. May 26, 2012 · 4. // #warning Incomplete method implementation. Just note, I have not added a prototype cell to my tableview like this tutorial shows but it shouldn't make a difference. if indexPath. You can add spacing by creating an extra view inside the cell that contains the content of the cell that has spacing between the top and the bottom. 1 1. frame, UIEdgeInsetsMake(10, 10, 10, 10)) // for only bottom use UIEdgeInsetsMake(0, 0, 10, 0) } I want to implement a table with: sections; every section will have footer and header; footer and header will be sticky to the table; between every section there is a space Sep 20, 2017 · 1. May 28, 2019 · So, to remove a cell from a table view you first remove it from your data source, then you call deleteRows(at:) on your table view, providing it with an array of index paths that should be zapped. intercellSpacing = NSSize(width: 0. separatorInset. width + shadowSize, height: self. Open up the Main. Change your didSelectRowAtIndexPath to: func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {. Jimmy James. Here's some example code to get you started: SAVE 50% To celebrate May 20, 2021 · We’ll ahead to create an empty swift file and create a class for UITableViewCell. 1, swift 3 with keyboard hiding UITextView when it becomeFirstResponder(), spent few hours to figure out what was the problem without any luck, finally created new test project with single UITableViewController and it worked, thereafter re-created the Table View Controller in storyboard - cells started to scroll to allow space for keyboard which appears just Overview. . setTitle("\(myArray[indexPath. cell. override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {. The solutions I read on here were as follows: Add an empty cell between each real cell (%2 condition) Use Sections instead of Rows; Put the cell's content in a container UIView and make the cell's height bigger than the container view. This seems to be some sort of a bug, but it is easily solved. Retrieving a value for a dictionary storing the horizontal position should be trivial in cellForRowAtIndexPath. I didn't have any luck setting it in the cellForRowAtIndexPath method, moving it to willDisplayCell fixed the issue with it not showing up. center cell Jan 8, 2017 · 0. row // set 1 row for each section func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 1 } // set distance between each table cell func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return 16. viewDidLoad() // Do any additional setup after loading the view, typically from a nib. //Whatever sets your sections. What is the correct way to stop this spacing from existing when displaying search results? Thank you! May 3, 2024 · 0. This answer is for AppKit. Oct 11, 2016 · Oct 11, 2016 at 13:30. You achieve adding spacing between cells is to make numberOfSections = array. override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {. tableFooterView = view. First, tell the table view that you want automatically sized cells, headers, and/or footers: Objective-C. You could achieve this by setting your numberOfRows in section to 1 and setting your numberofSections to the array of dynamic items that populate the cells. In UITableView you have 2 properties : separatorStyle and separatorColor, but maybe it is not enough for you. For setting space between rows. ios - UITableView: the proper way to display a separator for the last cell; ios - hide table view cell and remove table view space; ios - Custom edit view in UITableViewCell while swipe left. Update (9/16/2020): iOS 14 introduces issues related to keyboard safe area insets which basically make this approach invalid - it still works if your app is built with Xcode 11, but building with Xcode 12 will cause the cell layouts whose rects intersect with the keyboard rect to break. Oct 20, 2015 · Row Spacing. Code:. Open the Assistant Editor, and Ctrl+Drag from your UITableView to somewhere in your code. Like this. cellForRowAtIndexPath(indexPath) and get your cell. } Jan 9, 2015 · 1. swift file right away. withAlphaComponent(0. You can store the values of horizontal position and retrieve them when the cell is init'd in cellForRowAtIndexPath. This will appear as if cell width is reduced and user can scroll along the edges of the tableView. answered Jun 24, 2017 at 21:01. Jan 19, 2016 · 1. rowHeight = UITableViewAutomaticDimension tableView. Although @A-Live is technically correct, in order to prevent other issues, ex: you forget to put a indexPath. Otherwise you can snap your tableview to edge of the view and omit the code, because the purpose of the code is to compensate the size of navbar/tabbar, and May 23, 2016 · In this video tutorial I am going to share with you how to change UITableViewCell separator left side spacing or how to hide table cell separator completely using Xcode and how to do it programmatically using Swift. Drag a UIView from the object library and add it above the TableView as I've done in the image below. Normally, a cell’s height is determined by the table view delegate’s tableView:heightForRowAtIndexPath: method. Thanks. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return myNumberOfRows } func numberOfSections(in tableView Sep 25, 2021 · Check if you are only seeing this issue on iOS 15 and above. spacing = 8. #1 first Use method ViewForHeaderInSection as below -. self. row < 3 {. It solves the blank space at top of a grouped table view. It wasn't anything I did with the code, but rather in the storyboard. return sv. Jan 5, 2022 · The sectionHeaderView and the tableviewcell are apart in nib files. namePlace. axis = . } This method gives your the current displayed row. normal) button. In which case you would want to call reloadData() then set the contentSize. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 1 } return 1 i replace return 1 to test. One alternative approach you can try, take a UIView in UITableViewCell. class TableViewController: UITableViewController { var textArray = [String]() var cellsArray = ["1","2","3"] override func viewDidLoad() { super. edited Jun 20, 2020 at 9:12. If you really need a UITableView, try to add a Leading Space To Container Margin and a Trailing Space To Container Margin contraint between your Oct 24, 2015 · To hide to buttons after a swipe you can either set tableView. This is a very inconsistent bug. To create a basic header or footer with a text label, override the tableView(_:titleForHeaderInSection:) or tableView(_:titleForFooterInSection:) method Aug 12, 2015 · The best working Solution of adding Custom header view in UITableView for section in swift 4 is --. 825 12 28. 0 //Choose your custom row height. You do not need to call reloadData() unless the data has actually changed. count > 0 {. The UITableView has 3 sections, each containing 2 rows. Now, you can make round corners and add shadow on UIVIew. I want to use self-sizing cells to support accessibility, but in this case, some cells take up more space than they need. Jul 20, 2020 · Self-Sizing UITableView Cells with SwiftUI. May 17, 2020 · For this tutorial you will need to setup a tableview. Aug 20, 2017 · I'm trying to add spacing between my cells in a UITableView. 0) answered May 5 at 16:20. white. height + shadowSize)) Edit 2: I'd like to point out that all my cell's objects are inside a container UIView. (You can also create one using CocoaTouch option without a Nib file) I started by defining the first layer which Aug 12, 2020 · Select the new UITableViewCell (shows up as “Table View Cell” in the Document Outline). Hook Up the Outlets. Ever since its original introduction in 2019, SwiftUI has had really strong interoperability with UIKit. Jun 7, 2022 · Rendering SwiftUI views within UITableView or UICollectionView cells on iOS 16. Jun 25, 2017 · Creating the UITableViewCells. An example: if x == 0{. Yourarray. func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView. return cellSpacingHeight. defaultMinListRowHeight, 20) seemed to work. } Sep 19, 2013 · Swift 4 code: For tableview with no section headers you can add this code: func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return CGFloat. 2, but Oct 4, 2022 · xcode 8 swift 3 UItableview space between cells? 0. Sep 2, 2016 · Put this in your cellForRowAtIndexPath. estimatedRowHeight = 80 // for normal conditions this type of cell would have height of Jan 23, 2019 · SellerPlacesCell cell. In the Attributes Inspector, change it’s Style to “Basic”, and give it the Identifier “TextCell”. To do this we need to create a new method in our ViewController called registerTableViewCells. Mar 24, 2015 · If you want to add different sized borders to each side of the cell, you can also do this: let cell = tableView. Ask Question Asked 8 years, 10 months ago. 2. Jun 9, 2020 · If you are using auto layout, you can embed your cell design inside a view and add top and bottom spacing to that view with respect to content view. The problem should resolve itself. layoutSubviews() contentView. separatorInset = UIEdgeInsetsMake(0, 30, 0, 11 Dec 13, 2018 · I am using this code to create the stack view: let thestack: UIStackView = {. leastNonzeroMagnitude. Try my code: import UIKit class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var tableView: UITableView! May 12, 2024 · In Swift, you can adjust the spacing between UITableView cells by implementing the tableView(_:heightForRowAt:) method in your UITableViewDelegate. 4. EndyVelvet. iOS swift remove UITableView Cell separator space. July 20, 2020. text = locationsArray[indexPath. 0, height: 0. row] cell. // the following code increases cell border only on specified borders. rowHeight = UITableViewAutomaticDimension; tableView. center = cell. rowHeight = UITableViewAutomaticDimension. if #available(iOS 15. This method is called after the view has been loaded. Aug 7, 2015 · 183. reloadRowsAtIndexPaths(indexPaths: [NSIndexPath], withRowAnimation: UITableViewRowAnimation. viewDidLoad() //Register the different cells of the tableview. backgroundColor = UIColor. contentSize. Edit : I misinterpreted the question as asking for another view within the cellView, if so the delegate method heightForRowAtIndexPath is indeed correct as stated in the above answer. vh lz vk df jn kl ed kl kl ps