Ответ 1
Вот моя хакерская незавершенная реализация для людей, чтобы строить из.
Это должно работать для iOS6-- и iOS7.
Очевидно, что этот код находится в вашем подклассе UITableViewCell.
-(void)willTransitionToState:(UITableViewCellStateMask)state{
NSLog(@"EventTableCell willTransitionToState");
[super willTransitionToState:state];
if((state & UITableViewCellStateShowingDeleteConfirmationMask) == UITableViewCellStateShowingDeleteConfirmationMask){
[self recurseAndReplaceSubViewIfDeleteConfirmationControl:self.subviews];
[self performSelector:@selector(recurseAndReplaceSubViewIfDeleteConfirmationControl:) withObject:self.subviews afterDelay:0];
}
}
-(void)recurseAndReplaceSubViewIfDeleteConfirmationControl:(NSArray*)subviews{
NSString *delete_button_name = @"button_panorama_no_arrow";
for (UIView *subview in subviews)
{
//handles ios6 and earlier
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"])
{
//we'll add a view to cover the default control as the image used has a transparent BG
UIView *backgroundCoverDefaultControl = [[UIView alloc] initWithFrame:CGRectMake(0,0, 64, 33)];
[backgroundCoverDefaultControl setBackgroundColor:[UIColor whiteColor]];//assuming your view has a white BG
[[subview.subviews objectAtIndex:0] addSubview:backgroundCoverDefaultControl];
UIImage *deleteImage = [UIImage imageNamed:delete_button_name];
UIImageView *deleteBtn = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0,deleteImage.size.width, deleteImage.size.height)];
[deleteBtn setImage:[UIImage imageNamed:delete_button_name]];
[[subview.subviews objectAtIndex:0] addSubview:deleteBtn];
}
//the rest handles ios7
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationButton"])
{
UIButton *deleteButton = (UIButton *)subview;
[deleteButton setImage:[UIImage imageNamed:delete_button_name] forState:UIControlStateNormal];
[deleteButton setTitle:@"" forState:UIControlStateNormal];
[deleteButton setBackgroundColor:[UIColor clearColor]];
for(UIView* view in subview.subviews){
if([view isKindOfClass:[UILabel class]]){
[view removeFromSuperview];
}
}
}
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationView"])
{
for(UIView* innerSubView in subview.subviews){
if(![innerSubView isKindOfClass:[UIButton class]]){
[innerSubView removeFromSuperview];
}
}
}
if([subview.subviews count]>0){
[self recurseAndReplaceSubViewIfDeleteConfirmationControl:subview.subviews];
}
}
}
Я надеюсь, что это поможет кому-то.