TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Sep 2015 |
Maintained by Jiahai.
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;
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.