IPhone swap to delete button name

I realized that you need to use the following method and return what you want the new header to be like NSString. However, I do not know where to put this method. Where is it usually located?

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

I tried it in my TableViewController and it does not work:

Interface

#import <Three20/Three20.h>

@interface PositionsController : TTTableViewController {
}

@end

implementation

#import "PositionsController.h"
#import "NetworkController.h"
#import "PositionsDataSource.h"

@implementation PositionsController

- (id) init {
    if (self = [super init]) {
        self.variableHeightRows = NO;
    }

    return self;
}

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

@end

I won’t post all the code there, however everything works as it should, but I still get Delete as the title for my button, not Close .

Editable Working Code Three20 Library

, , , TTTableViewDragRefreshDelegate UITableView. :

- (id<UITableViewDelegate>)createDelegate {
        return [[[TTTableViewDragRefreshDelegate alloc] initWithController:self] autorelease];
}

, , UITableViewDelegate, , , , , TTTableViewDragRefreshDelegate . :

PositionsController.m createDelegate

- (id<UITableViewDelegate>)createDelegate {
     return [[[PositionsTableDelegate alloc] initWithController:self] autorelease];
 }

PositionsTableDelegate.h

#import <Three20/Three20.h>


@interface PositionsTableDelegate : TTTableViewDragRefreshDelegate <UITableViewDelegate> {

}

@end

PositionsTableDelegate.m

#import "PositionsTableDelegate.h"


@implementation PositionsTableDelegate

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

@end
+3
3

UITableView. , TableView.

delegate -property TableView PositionsController.

+4

UITableViewDelegate, , UITableView.

0

-, , TTTableController - , .

, , (, , ), "" tableView.

tableView, , setEditing:animated: .

See here for more information: http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html

Edit: The function you use must be in the delegate tableView.

0
source

Source: https://habr.com/ru/post/1783970/


All Articles