完全兼容 iOS 9
这是一个高度可定制且易于使用的解决方案,可以用于 UITableViewCell 的右侧菜单,通过“向左滑动以删除”的手势显示。
邮件应用风格的菜单 - 显示 & 隐藏示例
无需任何额外工作,只需通过默认的向左滑动以删除的手势即可显示右侧菜单视图。隐藏菜单也使用像点击或向左滑动一样的已知手势。
邮件应用风格的菜单 - 删除项目示例
删除行与默认实现一样简单。
自定义样式菜单 - 显示、隐藏 & 删除示例
使用自定义菜单位置的优势在于您可以避免陷入苹果风格的按钮,并且可以轻松地集成您自己的设计。
pod 'ABMenuTableViewCell', '~> 2.0'
添加到您的 Podfile),或者克隆此仓库并将 ABMenuTableViewCell 文件夹的内容拖动到您的项目中。- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *identifier = @"ABMenuTableViewCell";
ABMenuTableViewCell *cell = (ABMenuTableViewCell*)[tableView cellForRowAtIndexPath:indexPath];
if (!cell) {
cell = [[ABMenuTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
}
// use your own custom menu view
UIView *menuView = [[UIView alloc] initWithFrame:CGRectMake(.0, .0, 160.0, 44.0)];
menuView.backgroundColor = [UIColor redColor];
cell.rightMenuView = menuView;
cell.textLabel.text = @"Lorem ipsum dolor sit amet";
return cell;
}
ABMenuTableViewCell 由 Alex Bumbu 创建。
ABMenuTableViewCell 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。如需无版权信息的使用,请联系 Alex Bumbu。