I have subclassed UITableViewCell. This class is linked to the following xib, which is just a UITableViewCell with a label inside of it:
If you look closely at the bottom, you can see the divider there. How can I remove this?
Here's what the cells look like in a table view:
edit: My table view controller is a subclass of PFQueryTableViewController from the parse.com service. My apologies for neglecting to mention this.
edit2: I changed the colors of the separators to red and have discovered some very off behavior that might aid in figuring out why this isn't working. There seems to be some spacer on the far left of each divider:
Try to make it from the xib :
Go to xib
select table
make separator None.
You can do this with the UITableView property separatorStyle. Make sure the property is set to UITableViewCellSeparatorStyleNone and you should be good to go.
Set table separator style to none from design or code
It simple.. just Go to the Xib File where you have put the UITableView and right side in the attribute inspector you will find Seperator Option.. just select None in that
OR
You can do it manually with the code
tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
just write this in your viewDidLoad method and it will be done..
Found the problem. When I had adjusted the height of the table view cell to 125 over the usual 44, i had adjusted the height of the view sitting inside of the table view cell, instead of the actual view cell.
Thanks for the help anyways to everyone who provided suggestions.
Related
the problem here is that I've got a component thats a cell, and I want to include it in a tableview with some other icons and labels in the cell. Maybe the best solution here would be to include a tableview inside of the cells, with a unique cell in it. I've tried to do it and it worked but when it came to launch another screen when selecting the cell it only worked on the margin where the inside tableview isn't included, how could this be solved? something like this Thanks!
Change the isUserInteractionEnabled property of the inner table view to false.
When I drag and drop a Table View Cell to my UITableView on storyboard, it looks like this:
I would like to remove the separator line, I try to find from attribute inspector to remove separator line:
But I can't find any option for that. Is there a way to remove separator line of a table view cell in storyboard? (I am using xcode 9.1)
Please select the TableView and not the tableView Cell in the storyBoard. The option is there to set the separator style to none there.
Before Image
After Image
Hope this helps.
Md. Ibrahim Hassan answer work until Xcode 13. And if you need to add separator for some cell, I recommend to draw by using UIView with height 1px.
i am coding and ran into a problem. I want spacing between cells and spacing on the side. i tried heightForRowAtIndexPath:but got spacing on the main controller not between cells! I basically want fake margin between a custom nib UITableViewCell but could not find anything legible in swift on google, I Do not know objective C and would like to do this in swift. could someone tell me what i am doing wrong and how they would fix in in swift? thanks!
Hi your problem is logical so for swift and objective c solution would be same.
as you say u r using custom tableviewcell nib u can create this view with marginal space in nib file like
here blue color part is UIView you can add your cell component like label,textfield add here and yellow part is space that you want between cells now load this custom cell .nib in your table with table delegate method you will get the out put way you want.
here you heightForRowAtIndexPath that is use for whole row
hope this will give you idea how to get space
You have to create the inner content view to hold all the subviews. Then leave the margin between the inner content view and TableviewCell's content view.
I've been futzing around trying to get some padding between the bottom of my subview and its container UITableViewCell. I have an xib file, but changes to that don't seem to affect my actual ui (i've had to pragmatically change the tableviewcell height, for example).
I've also tried a few examples on SO regarding adjusting the center value of the subview, but no cigar.
Any ideas?
Thanks in Advance.
So, I decided to just move the individual elements within the inner cell which is less reusable than just adjusting the whole cell, but.. It will do for now!
Cheers.
As seen in the image of my design that i have attached, i want to merge(don't know wether thats the correct word) the first three cells so that i can display an image at the right side in the table itself. Is it possible?
No it's not possible. Instead, you can create first three as one cell(type1), other cells are other type(type2).
Update: see this tutorial for how to create custom cell.
You can create a UIView with fixed dimensions(say, 200x200) having 3 textfields (number, name & uom) to left and add UIImageView to right. Create IBOutlet of this view and name it. Add this view to the header of your UITableview.
self._table.tableHeaderView = yourview;
You should use a UICollectionView instead and apply a custom layout to achieve this.
Collection views provide the same general function as table views
except that a collection view is able to support more than just
single-column layouts. Collection views support customizable layouts
that can be used to implement multi-column grids, tiled layouts,
circular layouts, and many more. You can even change the layout of a
collection view dynamically if you want.
There are many tutorials on the Internet:
http://skeuo.com/uicollectionview-custom-layout-tutorial
http://www.raywenderlich.com/22324/beginning-uicollectionview-in-ios-6-part-12
Another option is to use UITableView and a custom UITableViewCell.
Example:
http://www.idev101.com/code/User_Interface/UITableView/customizing.html
add it in the first cell.The size of you imageview shoud be greater than the cell height.Make sure cell.cliptobounds is set false.Make sure you set the zpositon of imageview to 1 by imageView.layer.zPosiziton = 1.
Actually, you can add your imageView as subview of tableView, so your didSelectRowAtIndexPath: will working as usual