SESlideTableViewCell 0.7.2

SESlideTableViewCell 0.7.2

测试测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2019年4月

Junji Tago维护。




  • Junji Tago

SESlideTableViewCell

一个可以使用滑动来显示按钮的 UITableViewCell 子类。

特性

  • 轻量级。仅由一个头文件和一个源文件组成。
  • 指示器,显示您可以滑动的方式。
  • 兼容 iOS 7 - 9。
  • 支持 Swift 语言。

要求

SESlideTableViewCell 在 iOS 7 及更高版本上运行。它也可以在 Swift 语言中使用。

如何设置

使用 CocoaPods 设置 SESlideTableViewCell。

platform :ios, "7.0"
pod 'SESlideTableViewCell'

有关 CocoaPods 的更多信息,请参阅 https://cocoapods.org.cn/

Objective-C入门

您可以在您的UITableViewController中这样创建一个SESlideTableViewCell。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	NSString * const CELL_ID = @"Cell";
	SESlideTableViewCell* cell = (SESlideTableViewCell*)[tableView dequeueReusableCellWithIdentifier:CELL_ID];
	if (!cell) {
		cell = [[SESlideTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CELL_ID];
		cell.delegate = self;
		[cell addRightButtonWithText:@"Hello" textColor:[UIColor whiteColor] backgroundColor:[UIColor colorWithHue:0.0/360.0 saturation:0.8 brightness:0.9 alpha:1.0]];
		[cell addRightButtonWithText:@"World!!" textColor:[UIColor whiteColor] backgroundColor:[UIColor colorWithHue:180.0/360.0 saturation:0.8 brightness:0.9 alpha:1.0]];
	}
	return cell;
}

您可以使用SESlideTableViewCellDelegate方法知道哪个按钮被触发。

- (void)slideTableViewCell:(SESlideTableViewCell*)cell didTriggerRightButton:(NSInteger)buttonIndex {
	NSLog(@"right button triggered:%d", (int)buttonIndex);
}

Swift入门

您可以在您的UITableViewController中这样创建一个SESlideTableViewCell。

override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell? {
	let CELL_ID = "Cell"
	var cell = tableView.dequeueReusableCellWithIdentifier(CELL_ID) as? SESlideTableViewCell
	if !cell {
		cell = SESlideTableViewCell(style: .Default, reuseIdentifier: CELL_ID)
		cell!.delegate = self
		cell!.addRightButtonWithText("Hello", textColor: UIColor.whiteColor(), backgroundColor: UIColor(hue: 0.0/360.0, saturation: 0.8, brightness: 0.9, alpha: 1.0))
		cell!.addRightButtonWithText("World!!", textColor: UIColor.whiteColor(), backgroundColor: UIColor(hue: 180.0/360.0, saturation: 0.8, brightness: 0.9, alpha: 1.0))
	}
	
    return cell
}

您可以使用SESlideTableViewCellDelegate方法知道哪个按钮被触发。

func slideTableViewCell(cell: SESlideTableViewCell!, didTriggerRightButton buttonIndex: NSInteger) {
	let indexPath = tableView.indexPathForCell(cell)
	println("right button \(buttonIndex) tapped in cell \(indexPath.section) - \(indexPath.row)")
}

文档

参考手册可在以下位置获取:http://cocoadocs.org/docsets/SESlideTableViewCell/

许可证

MIT许可证。

限制

当按钮显示时,单元格中内容的动画会停止。这来自使用快照来显示单元格中现有的内容。

致谢

感谢您的贡献。