UITableViewCell overlaps the delete button in the UITableView - ios

As shown in the image below when I enable the edit mode for the tableview and click the (-) button the delete button is hidden behind the UITAbleViewCell.
Not sure what causing the issue as I have used same similar type of custom UITAbleVeiwCells and delete worked without any problem.
Can someone enlighten me where I'm going wrong and why cell behaves in peculiar way.

I think cell.clipsToBounds = YES; can resolve the issue.
Also try using the imageView.maskToBounds = YES;
I don't know if you are having the images locally or you are downloading it from server. It could happen that the image is not downloaded when the delete button is shown and when it's downloaded the image is shown up as per it's size (contentMode). That's why I think setting imageView.masksToBounds could resolve the issue.

decrease the width of the imageview or view whatever that you gives to the image....

Related

Constraints not working in TableViewCell

I'm learning how to use CoreData to store images, and I'm making a blog reader. I have a view That shows all the info saved as a list and when you click it takes you to that article. My problem is that I can't make TableViewCells look as intended. I have added the constraints and not a single of them is being placed.
Here are my constraints:
And this is the result:
I've deleted them, cleaned, closed xCode, put them again and the same result. Found this answer, checked and nothing. Also this one. In the same project, I have another TableView and it works fine, any ideas why this is happening? Thanks a lot!
Looks like image is overflowing form the container. Try this
Set the UIImageView content mode to UIViewContentModeScaleAspectFill
Set UIImageView clipToBounds to true.
It seems like issue not because of constraints. it because of image to solution for this issue
You have two option to solve this
1) Via code
cell.YOUR_IMAGE_VIEW.clipsToBounds = true
2) Via Interface Builder
Hope this will help you

iOS - rectangle appears after tapping button

I have two UIButtons and a strange rectangle appears when tapping one of them. I don't know why. I set the images as background images on the button and it worked fine until now.
What I changed now is that I set each button isSelected property and before I did not
Like this:
thumbsDownButton.isSelected = true
thumbsUpButton.isSelected = false
Obviously what I want is for that rectangle to go away
The style was set to System. Setting it to Custom fixed the problem and the rectangle is not appearing anymore. I set it from the xib (if it makes any difference)
Add this Code
thumbsDownButton.tintColor = UIColor.white
It seems your frame may be calculated in the wrong way.
Try to use this one to check it.
button.clipToBounds = true
Please share more code related of initializing and setting up the frame of your view.

UITableView "bulk select" not showing selected checkmarks in the selection circles, showing right side checkmark not left side

I am attempting to reproduce this behavior (see screenshot below, the "mail multiple select to delete" behavior) on an iOS8 Swift application. When set to "edit" the left selection circles are presented, but upon selection they do not change to a blue checkmark. (Nothing visible happens, or it happens off to the right ... off screen.)
From various Google searches I've tried setting the accessoryType to be checkbox, but that appears on the right (not the left.) [Is that old advice, is adding a checkmark still the approach to take?]
I've scoured this sample (even downloading it and running it and tweaking it closer to my code, and it works) but I cannot see the delta between it and my application.
Some data points:
Xcode 7
iOS8 + (testing on 8 and 9)
Swift 2.0
Storyboard configuration of the tableview, etc.
Custom layout cells. They use the content view for some text, nothing outside. Autolayout.
Single selection when NOT editing (or so I believe)
Multiple selection when editing (to get this effect.)
DataSource returns canEdit "true" for most (not all) cells. Circles only show next to those editable, matching expectations.
Delegate is not returning any "editing style" value. (Tried w/ & w/o.)
Delegate does NOT deselect in "didSelect" handler.
When I try setting accesoryType to Checkmark in didSelect (which many posting suggest, but I don't see it in the sample) it comes on the right not left.
Other StackOverflow questions / answers imply something is causing UITableView to fail to know to put the checkmark on the left not the right. I can believe that, but I cannot find it. Any help appreciated.
The desired effect (from sample screenshot):
https://developer.apple.com/library/ios/samplecode/TableMultiSelect/Introduction/Intro.html
Table Settings
Table Cell Settings
If you have selectionStyle = .None in your cellForRowAtIndexPath, remove it.
I was in the same exact boat as you (using Xcode 7, iOS9, Swift 2.0). Most of the articles I found online were about the checkmark on the right and my storyboard looked perfect. My only problem is that I could never get the checkmark on the left to show up when I tapped on the row.
With your post I was able to compare source code and figure it out - thanks!
Make sure cell's tint color is NOT white, otherwise you will get a white checkmark over a white circle...
In my case, it was a combination of the accepted answer as well as the UITableViewCell Selection set in the storyboard/IB. I had Selection set to "None" to prevent selection highlighting. You can't do that if you want the edit checkmarks to show. Just an additional help for someone who may find this down the road!
I solved this problem.
Set selectionStyle as Default.
My method in sub-class UITableViewCell.
override func awakeFromNib() {
super.awakeFromNib()
//Here I solved problem
let bgView = UIView()
bgView.frame = self.frame
bgView.backgroundColor = selectionColor //Here your color
self.selectedBackgroundView? = bgView
}

Layout changes after aborting delete operation of uitableviewcell

I have a customer uitableviewcell with an image that is aligned to the right of the cell. When I swipe left to delete, and then abort, the image shows up even more to the right then before. Look at the attached image.
It looks like the cell is in some sort of edit mode, but I am not sure.
If I try the same approach on the cell below, it shows up in the same way as before (incorrect), but the cell that was previously shown incorrect goes back to normal.
So only one cell at a time...
Any ideas?
Thanks!
/Henrik
I had the same problem, and I was able to solve it by setting the cell's accessoryView explicitly:
-(void) awakeFromNib
{
self.accessoryView = [[UIView alloc] initWithFrame:CGRectZero];
}
I have the same problem. I analyzed the size of the content view before and after aborting the delete operation.
Initial frame dimensions of the cells.contentView:
cell.contentView: Origin: (0.000000, 0.000000), size: (568.000000,44.000000)
After aborting the delete operation:
cell.contentView: Origin: (0.000000, 0.000000), size: (320.000000,43.500000)
Currently I do not have a solution yet but I am investigating it further.
It looks like this issue dissapeared when I built my app using xcode 7 and running it on ios9. However, I Think that the main reason was just xcode 7.
Please try it out...
/Henrik

What exactly IS the highlighted image in a UIImageView?

This question boggles my mind and I cannot find an answer. I looked all over the documentation, tried out code, and searched Google, but I can't find anything. The UIImageView in iOS programming can have an image set to it, but you can also set a highlighted image to it. What exactly is this highlighted image?
you can set two different images to an UIImageView, one to its image property, another to its highlightedImage property.
There are many cases where you want to change the state of the image (eg: a checkmark) from off to on or vice versa. in that case, instead of you setting the UIImageView's image to the appropriate one everytime, you can just say
theCheckMarkImageView.image = regularImage;//set the regular image
theCheckMarkImageView.highLightedImage = highlightedImage;
(based on your logic show it highlighted or not).
theCheckMarkImageView.highlighted = YES/NO;
In addition to all this, do check Ethan Huang's answer about how tabelviewcell works with this property. Quite useful if you are showing different images based on cell selection.
highlightedImage use for highlight ImageView,simple.
imageView.highlightedImage = [UIImage imageNamed:#"hightlighted.png"];
imageView.highlighted = YES;
Don't need to waste time to search or read a lot. Objective-C is meaningful language. Just drag ImageView and make a try code, step by step test all property, method in UIImageView.h(in UIKit framework) and you'll understand.
Do the same with other UI element.
Besides Nitin Alabur's answer, a useful tip here:
UITableViewCell or UICollectionViewCell has a .selected property. If you put an UIImageView in a cell, then, when you select the cell, the imageView will use the .highlightedImage instead of .image.
Thus you can make cell selection visual state easily.
The highlighted image is for when you have a control that has a UIImageView that can be pressed. While the user is pressing the control, the highlighted image is shown. When the control is not being pressed, the normal image is shown.
All commenters have been wrong or answered the wrong question or been too wordy. Here's the simple and correct answer:
The highlighted image state is when the user's finger is touching the imageview.

Resources