Skip to content

istsest/SwipeTableViewCell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Swipe Table View Cell

Sample Video

Alt text

It is so easy to use.

  1. Create views and assign to leftView, rightView, or both of the PCSwipeTableViewCell class.
  2. Implement delegates.
  • It is possible to encounter the Delete button, which is provided by iOS basically.

- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString			*CellIdentifier = [NSString stringWithFormat:@"PCSwipeTableViewCell"];
    PCSwipeTableViewCell	*cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
	static UILabel		*leftView = nil, *rightView = nil;
    
	if(cell == nil)
	{
        cell = [[PCSwipeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
		if(!leftView)
		{
			leftView = [[UILabel alloc] init];
			leftView.contentMode = UIViewContentModeCenter;
			leftView.backgroundColor = [UIColor darkGrayColor];
			leftView.textColor = [UIColor whiteColor];
			leftView.textAlignment = NSTextAlignmentCenter;
			leftView.text = @"Share";
		}
		[cell setLeftView:leftView maximumWidth:100];
		if(!rightView)
		{
			rightView = [[UILabel alloc] init];
			rightView.contentMode = UIViewContentModeCenter;
			rightView.backgroundColor = [UIColor darkGrayColor];
			rightView.textColor = [UIColor whiteColor];
			rightView.textAlignment = NSTextAlignmentCenter;
			rightView.text = @"Detail...";
		}
		[cell setRightView:rightView maximumWidth:100];
		cell.swipeDelegate = self;
	}
	
	cell.textLabel.text = [_arrayData objectAtIndex:indexPath.row];
	
	return cell;
}

- (void)swipeLeftToRightTableViewCell:(PCSwipeTableViewCell *)swipeTableViewCell
{
	NSLog(@"Selected Share");
}

- (void)swipeRightToLeftTableViewCell:(PCSwipeTableViewCell *)swipeTableViewCell
{
	NSLog(@"Selected Detail");
}

About

Swipe Table View Cell for iOS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published