在故事板上使用原型单元的可转换单元

时间:2015-12-02 08:51:57

标签: ios objective-c uitableview

我在故事板上准备了我的单元格,并从Swipable单元类继承了我的类。但是滑动没有动作。是否可以在故​​事板上进行,或者我是否需要以硬编码的方式进行。

我的细胞等级如下;

@interface SpendListExtendedTableViewCell : MGSwipeTableCell

@property(nonatomic,weak) IBOutlet UIButton *installments;
@property(nonatomic,weak) IBOutlet UIImageView *cardTypeImageView;
@property(nonatomic,weak) IBOutlet UILabel *last4DigitLabel;
@end

在我的VC中; ​​

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

SpendListExtendedTableViewCell *cell = [_cardSpentList dequeueReusableCellWithIdentifier:cellIdentifier];


NSMutableDictionary *tempDict = [feedArray objectAtIndex:indexPath.row];

if([[tempDict objectForKey:@"cardType"] isEqualToString:@"V"])
    [cell.cardTypeImageView setImage:[UIImage imageNamed:@"visa2.png"]];
else
    [cell.cardTypeImageView setImage:[UIImage imageNamed:@"mclogo2.png"]];

[cell.last4DigitLabel setText:[NSString stringWithFormat:@"-%@",[tempDict objectForKey:@"cardLast4Digit"]]];

cell.amount = [tempDict objectForKey:@"spendAmount"];
cell.delegate2 = self;
cell.delegate = self;

cell.rightSwipeSettings.transition = 2;

cell.rightButtons = [self createRightButtonsForMyFollows:1];
cell.rightButtons = [self createRightButtonsForStocks:3];

cell.selectionStyle = UITableViewCellSelectionStyleNone;

//NSLog(@"%@",liveScoreObject.currentMinuteStatus);

return cell;

}

setRightButtons

-(NSArray *) createRightButtonsForStocks: (int) number
{
NSMutableArray * result = [NSMutableArray array];
NSString* titles[3] = {@"Sat",@"Al",@"İzle"};
UIColor * colors[3] = {[UIColor redColor], [UIColor blueColor],[UIColor brownColor]};
for (int i = 0; i < number; ++i)
{
    MGSwipeButton * button = [MGSwipeButton buttonWithTitle:titles[i] backgroundColor:colors[i] callback:^BOOL(MGSwipeTableCell * sender){
        NSLog(@"Convenience callback received (right).");
        return YES;
    }];
    [result addObject:button];
}
return result;
}

可能出错了什么?

提前致谢

0 个答案:

没有答案