pod 'JHMenuTableView'
JHMenuTableView
文件夹中的所有文件添加至工程中#import "JHMenuTableView.h"
[_tableView openJHTableViewMenu];
JHMenuAction *action = [[JHMenuAction alloc] init];
action.title = @"标为\n已读";
action.titleColor = [UIColor whiteColor];
action.backgroundColor = JHRGBA(148, 158, 167, 1);
action.actionBlock = ^(JHMenuTableViewCell *cell, NSIndexPath *indexPath){
JHLog(@"标为已读:%@,row:%d",cell,indexPath.row);
};
self.actions = @[action];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identifier = @"cell";
JHMenuTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if(cell == nil)
{
//-----------------------此处请务必按此设置--------------------------
cell = [[JHMenuTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
//不需要的菜单可以不用设置
cell.leftActions = self.iActions;
cell.rightActions = self.actions;
cell.menuState = tableView.currentMenuTableCell.menuState;
//----------------------------------------------------------------
UILabel *textField = [[UILabel alloc] initWithFrame:CGRectMake(0, 6, 120, 32)];
textField.tag = 88;
[cell.customView addSubview:textField];
cell.customView.layer.borderColor = [UIColor blackColor].CGColor;
cell.customView.layer.borderWidth = 0.5;
}
//此步骤可针对不同的cell修改JHAction
//使用时请注意,防止JHAction错乱
if(indexPath.row % 2 == 0)
{
cell.rightActions = self.actions1;
}
else
{
cell.rightActions = self.actions;
}
JHMenuImageAction *imageAction = [self.iActions objectAtIndex:0];
imageAction.selected = [self.selectedArray containsObject:indexPath];
cell.leftActions = self.iActions;
UILabel *label = (UILabel *)[cell.customView viewWithTag:88];
label.textAlignment = NSTextAlignmentCenter;
label.text = [NSString stringWithFormat:@"%d",indexPath.row];
return cell;
}
#pragma mark -
#pragma mark - JHMenuTableView参数配置
/**
* 支持横屏模式
*/
extern const BOOL kJHMenuSupportLandspaceOrientation;
/**
* JHTextActionButton文本的字体
*/
extern const NSInteger kJHTextActionButtonTextFontSize;
/**
* Menu展开/收缩的动画持续时间,单位为秒
*/
extern const float kJHMenuExpandAnimationDuration;
#pragma mark - 左侧菜单参数配置
/**
* 左侧JHActionButton的宽度
*/
extern const NSInteger kJHActionLeftButtonWidth;
/**
* 展开左侧Menu时,是否显示更多按钮
*/
extern const BOOL kJHActionLeftMoreButtonShow;
/**
* 左侧菜单更多按钮出现的index,从左向右,从0开始
*/
extern const NSInteger kJHActionLeftMoreButtonIndex;
/**
* 全部左侧菜单联动
*/
extern const BOOL kJHMenuMoveAllLeftCells;
#pragma mark - 右侧菜单参数配置
/**
* 右侧侧JHActionButton的宽度
*/
extern const NSInteger kJHActionRightButtonWidth;
/**
* 展开右侧Menu时,是否显示更多按钮
*/
extern const BOOL kJHActionRightMoreButtonShow;
/**
* 右侧菜单更多按钮出现的index,从右向左,从0开始
*/
extern const NSInteger kJHActionRightMoreButtonIndex;
/**
* 全部右侧菜单联动
*/
extern const BOOL kJHMenuMoveAllRightCells;
此协议授予任何 obtening 此软件及相关的文档文件的副本(“软件”)的人以下权利,免费的前提下,无限制地处理软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本,并允许任何对象提供软件的人使用此软件,受以下条件的约束:
上述版权声明和本许可声明应包含在软件的所有副本或实质性部分中。
软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、特定用途适用性和非侵权性保证。在任何情况下,作者或版权所有者不对任何索赔、损害或其他责任承担义务,无论该义务是否源于合同行为、侵权行为或其他行为,无论该行为是在软件或其使用或其他处理中发生的。