Latest 1.0.3
Homepage https://github.com/songyutao/YTTableView
License MIT
Platforms ios 7.0, requires ARC
Frameworks UIKit
Authors
  1. add the slide menu function.
  2. To optimize the tableview sliding carton, you simply set the heightCached attribute.

Examples:

self.tableView = [[YTTableView alloc] initWithFrame:self.view.bounds];
self.tableView.delegate = (id <UITableViewDelegate>)self;
self.tableView.dataSource = (id <UITableViewDataSource>)self;

self.tableView.menuDelegate = (id<YTTableViewMenuDelegate>)self;
self.tableView.menuItemLayout = EMenuItemLayoutIconTop;
self.tableView.menuTitleColor = [UIColor yellowColor];

self.tableView.heightCached = YES;
[self.view addSubview:self.tableView];

#pragma - mark - YTTableViewMenuDelegate
- (BOOL)tableView:(YTTableView *)tableView supportMenuAtIndexPath:(NSIndexPath *)indexPath
{
    return indexPath.row % 2 == 0 ? YES : NO;
}

- (NSUInteger)tableView:(YTTableView *)tableView menuItemCountAtIndexPath:(NSIndexPath *)indexPath
{
    if(indexPath.row == 0)
        return 3;
    return 2;
}

- (UIImage *)tableView:(YTTableView *)tableView menuIconAtIndex:(NSUInteger)index atIndexPath:(NSIndexPath *)indexPath
{
    if(indexPath.row == 0)
    {
        return [UIImage imageNamed:@"favorite"];
    }
    return nil;
}

- (NSString *)tableView:(YTTableView *)tableView menuTitleAtIndex:(NSUInteger)index atIndexPath:(NSIndexPath *)indexPath
{
    if(indexPath.row == 0)
        return [NSString stringWithFormat:@"菜单%lu", (unsigned long)index];
        return index == 0 ? @"编辑" : @"更多";
}

- (UIColor *)tableView:(YTTableView *)tableView menuColorAtIndex:(NSUInteger)index atIndexPath:(NSIndexPath *)indexPath
{
    return index == 0 ? [UIColor redColor] : [UIColor greenColor];
}

Demo:

YTTableView

Latest podspec

{
    "name": "YTTableView",
    "platforms": {
        "ios": "7.0"
    },
    "version": "1.0.3",
    "license": "MIT",
    "summary": "Tableview add slide menu function, and add cell height cache function",
    "homepage": "https://github.com/songyutao/YTTableView",
    "authors": {
        "u5b8bu7389u6d9b": "[email protected]"
    },
    "source": {
        "git": "https://github.com/songyutao/YTTableView.git",
        "tag": "1.0.3"
    },
    "source_files": "YTTableView/YTTableView",
    "frameworks": [
        "UIKit"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This