UITableViewCellAccessoryCheckmark and AutoLayout constraints
This behavior is by design.
The simplest way to get the behavior you want is to set an empty accessory view on every cell which will move all the content to the left the same distance as the checkmark.
Defining Constraints for UITableView with UITableViewCellAccessoryType.DisclosureIndicator
It is not a build type. The answer in the link you're refering is saying that you should set a non-nil view to the accessoryView
property of the UITableViewCell
instance. Eg. yourCell.accessoryView = someBlankView
.
Weird animation behaviour while using autolayout in .xib
Fixed the problem by updating the frame and then calling the [self layoutIfNeeded];
Nothing will work if you miss [self layoutIfNeeded];
function call after updating your frames.
How to change constants in AutoLayout constraints that are created in IB programmatically?
I have assigned a variable similarly as you would for any UI element - NSLayoutConstraint.
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *labelConstraint;
And in the code you would do something like:
self.labelConstraint.constant = 10;
How to center text in a UITableViewCell when accessory is UITableViewCellAccessoryCheckmark
iOS 8+ solution:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
cell.textLabel.text = ...;
if (/* your condition */) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
cell.layoutMargins = UIEdgeInsetsMake(0, 40, 0, 10);
} else {
cell.accessoryType = UITableViewCellAccessoryNone;
cell.layoutMargins = UIEdgeInsetsMake(0, 10, 0, 10);
}
return cell;
}
Related Topics
iOS Apns "Best-Effort" Fallback
How to Launch an App in Foreground When I Enter an Ibeacon Range
Cgcolorgetcomponents() Not Returning the Correct Values for Black and for White
Changes to Swiftui Fetchrequest Not Triggering View Refresh
Creating an Image Format with an Unknown Type Is an Error Objective-C Xcode 8
Error: Uitableview Jump to Top with Uitableviewautomaticdimension
How to Parse Array of JSON to Array in Swift
How to Access an Iboutlet from Another Class
Can't Send Push Notifications Using the Server API
Will Fork() in iOS App Likely Be Rejected by Apple's Vetting Process
Get Height of iOS Keyboard Without Displaying Keyboard
iOS 7 Uitoolbar Overriding with Status Bar
Swift Execute Asynchronous Tasks in Order
Admob Sdk - iOS -File Not Found
Disable iOS Simulator 'Connect Hardware Keyboard' Programmatically
Custom Scenekit Geometry in Swift on iOS Not Working But Equivalent Objective C Code Does