alikaragoz / MCSwipeTableViewCell

:point_up_2: Convenient UITableViewCell subclass that implements a swippable content to trigger actions (similar to the Mailbox app).
MIT License
2.96k stars 412 forks source link

When swipe the label in the cell with xib it's offset of some pixel #10

Closed Piero87 closed 11 years ago

Piero87 commented 11 years ago

Hello, i have problem with your amazing project, i have a uitableviewcell xib with a uilabel in it, and a subclass of it, here the the snippet:

#import <UIKit/UIKit.h>
#import "MCSwipeTableViewCell.h"

@interface ListViewCell : MCSwipeTableViewCell

@property (weak, nonatomic) IBOutlet UILabel *listName;
@property (weak, nonatomic) IBOutlet UIImageView *selectImg;

@end

and then in the .m file there is nothing, then i use your project in this way:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"ListCell";

ListViewCell *cell = (ListViewCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
      NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ListViewCell_iPhone" owner:self options:nil];
        cell = [nib objectAtIndex:0];
}

[cell setDelegate:self];

[cell setFirstStateIconName:@"check.png"
                 firstColor:[UIColor colorWithRed:85.0/255.0 green:213.0/255.0 blue:80.0/255.0 alpha:0.0]
        secondStateIconName:nil
                secondColor:nil
              thirdIconName:@"cross.png"
                 thirdColor:[UIColor colorWithRed:232.0/255.0 green:61.0/255.0 blue:14.0/255.0 alpha:0.0]
             fourthIconName:nil
                fourthColor:nil];

cell.listName.text = [[self.list objectAtIndex:indexPath.row] name];

[cell setMode:MCSwipeTableViewCellModeSwitch];

return cell;
}

now, the problem is this, when i swipe on the cell, and i release it, the label in cell it's offset on the left of some pixel, then, when i click on the row it return at the normal position, how i can solve this problem?

alikaragoz commented 11 years ago

I think this is related to the fact that you are using auto-layout in your xib. Unfortunately this lib isn't auto-layout compatible so you'll need to desactive it on your xib.

l4u commented 11 years ago

This might be related to accessory type