UITableViewCell like mail on iphone

限于喜欢 提交于 2019-12-12 01:18:04

问题


How can I adjust a UITableViewCell so that it would show two fields after swiping it left - identical to how the mail client does it? Right now I only see the "Delete" button. I would like to have the "More" field included there, too...

Also, for the first if clause Cell I do not get a "Insert" field.

- (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {

    if(indexPath.row == self.reports.count){
        return UITableViewCellEditingStyleInsert;
    } else {
        return UITableViewCellEditingStyleDelete;
    }
}

Is there a way to combine the fields with the | operator or something? Thanks, EL-


回答1:


You can use undocumented delegate methods for UITableView in iOS7

- (NSString *)tableView:(UITableView *)tableView titleForSwipeAccessoryButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return @"More";
}

- (void)tableView:(UITableView *)tableView swipeAccessoryButtonPushedForRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self setEditing:NO animated:YES];
}

It seems that they are not private and can be submitted to appStore.



来源:https://stackoverflow.com/questions/23484608/uitableviewcell-like-mail-on-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!