如何添加更多按钮的UITableViewCell当滚动呢? [英] How to Add more button to UITableViewCell When scrolling it?
问题描述
当我们正在滚动(向左滑动)的UITableViewCell
,它会显示一个删除按钮,但我想补充的是其他的按钮,我应该怎么办?
When we are scrolling(slide to the left) UITableViewCell
,it displays a delete button,but I want to add other button on it,how should I do?
我想要的风格就像是iOS中7系统邮件应用程序,存在的UITableViewCell两个按钮,一个是删除按钮,另一种是更为按钮。
The style I want is like the system mail app in iOS 7, there is two buttons in UITableviewCell,one is delete button, another is more button.
请提出任何想法
感谢
推荐答案
您可以创建更多的按钮,使用这种方法的例子。
you can create more button use this example approach
https://github.com/scheinem/MSCMoreOptionTableViewCell
此链接的例子是有帮助的更多,你可以创建自定义更多的按钮。
this link example is helpful more and you can create customize more button.
https://github.com/CEWendel/SWTableViewCell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"Cell";
SWTableViewCell *cell = (SWTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
NSMutableArray *leftUtilityButtons = [NSMutableArray new];
NSMutableArray *rightUtilityButtons = [NSMutableArray new];
[leftUtilityButtons addUtilityButtonWithColor:
[UIColor colorWithRed:0.07 green:0.75f blue:0.16f alpha:1.0]
icon:[UIImage imageNamed:@"check.png"]];
[leftUtilityButtons addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:1.0f blue:0.35f alpha:1.0]
icon:[UIImage imageNamed:@"clock.png"]];
[leftUtilityButtons addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:0.231f blue:0.188f alpha:1.0]
icon:[UIImage imageNamed:@"cross.png"]];
[leftUtilityButtons addUtilityButtonWithColor:
[UIColor colorWithRed:0.55f green:0.27f blue:0.07f alpha:1.0]
icon:[UIImage imageNamed:@"list.png"]];
[rightUtilityButtons addUtilityButtonWithColor:
[UIColor colorWithRed:0.78f green:0.78f blue:0.8f alpha:1.0]
title:@"More"];
[rightUtilityButtons addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:0.231f blue:0.188 alpha:1.0f]
title:@"Delete"];
cell = [[SWTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:cellIdentifier
containingTableView:_tableView // For row height and selection
leftUtilityButtons:leftUtilityButtons
rightUtilityButtons:rightUtilityButtons];
cell.delegate = self;
}
NSDate *dateObject = _testArray[indexPath.row];
cell.textLabel.text = [dateObject description];
cell.detailTextLabel.text = @"Some detail text";
return cell;
}
这篇关于如何添加更多按钮的UITableViewCell当滚动呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!