I add a datetime label on the right of a table cell. When swip-to-delete shows the “Delete” button, the datetime label need to shift left a little bit. But how to get the “Delete” button’s size?
I tried to find it in the cell.subviews but failed.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t have to know the button’s size. Instead, use the size of the cell’s
contentViewproperty to calculate the sizes of the subviews. When swiping over a cell, UIKit will adapt thecontentView‘s size and calllayoutSubviewson the cell-object. In your subclass of UITableViewCell, overwrite thelayoutSubviewsmethod and set the appropriate sizes to the subviews.Look at RecipeTableViewCell.m of Apple’s iPhoneCoreDataRecipes sample code.