After searching all over internet for a long time, but not getting the appropriate answer. I am putting the UITableView in editing mode and selecting multiple rows at a time. It is working great, but I wanted to change the color of checkmark from red to blue same as it is in the iPhone email app.
Any help would be appreciated.
Edited Version:
Here is my code...
in my ViewDidLoad function:
- (void)viewDidLoad
{
...
[deviceTableVIew setAllowsSelectionDuringEditing:YES];
[deviceTableVIew setAllowsMultipleSelectionDuringEditing:YES];
[super viewDidLoad];
}
I have two UIButtons whhich set the editing mode for the tableview as follows:
-(IBAction)control:(id)sender{
btnControl.enabled = false;
btnControl.hidden = true;
btnCancel.enabled = true;
btnCancel.hidden = false;
stateToggleToolbar.hidden = false;
[self.deviceTableVIew setEditing:YES animated:YES];
}
-(IBAction)cancel:(id)sender{
btnCancel.enabled = false;
btnCancel.hidden = true;
btnControl.enabled = true;
btnControl.hidden = false;
stateToggleToolbar.hidden = true;
[self.deviceTableVIew setEditing:NO animated:YES];
}
The UITableView delegate methods are:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//setting up the cells here
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
...
if ([tableView isEditing] == YES) {
// Do Nothing
}else{
[self.navigationController pushViewController:viewController animated:YES];
}
}
-(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
return 3;
}
One line solution is here)
Just set cell tintColor in your cellForRow:atIndexPath method.
cell.tintColor = UIColor.red
Below is swift code:
func tableView(tableView: UITableView,
cellForRowAtIndexPath indexPath: NSIndexPath)
-> UITableViewCell
{
//get cell to configure from tableView
let cell = tableView.dequeueReusableCellWithIdentifier("myCellIdentifier", forIndexPath: indexPath) as UITableViewCell
//This line will change checkmark color of your awesome cell
cell.tintColor = UIColor.redColor()
// Configure cell
// ...
//work is done! Let put the cell back to the tableView))
return cell
}
And this is the result of selected and not selected cells::
You cant change checkmark color as its not supported.The thing which you can do is make an image and add following code in your cellForRowAtIndexPath
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
selected=[[NSMutableArray alloc] init];
for(int i=0;i<10;i++){
[selected addObject:#"0"];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text=[NSString stringWithFormat:#"hello %d",indexPath.row];
if([[selected objectAtIndex:indexPath.row] isEqualToString:#"1"]){
cell.accessoryType=UITableViewCellAccessoryCheckmark;
}
else{
cell.accessoryType=UITableViewCellAccessoryNone;
}
// Configure the cell...
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if([[selected objectAtIndex:indexPath.row] isEqualToString:#"0"]){
[selected replaceObjectAtIndex:indexPath.row withObject:#"1"];
}
else{
[selected replaceObjectAtIndex:indexPath.row withObject:#"0"];
}
[tbl reloadData];
}
You can change the checkmark image. Create check mark image with check mark image and color.
Then replace image name in the below code. This works fine for iOS 6 and below
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
if (self.isEditing) {
if (selected){
for (UIView *subview in self.subviews) {
if ([NSStringFromClass([subview class]) isEqualToString:#"UITableViewCellEditControl"]) {
for (UIView *aView in subview.subviews) {
if ([NSStringFromClass([subview class]) isEqualToString:#"UITableViewCellEditControl"]) {
[aView.layer setContents:(id)[UIImage imageNamed:#"delete_check.png"].CGImage];
}
}
}
}
}
}
}
Related
I have a strange problem with UITableView:
My tableview shows the names of objects from which the user can select one. The value is saved. When the tableview comes up the row is selected (in cellForRowAtIndexPath). But in viewWillAppear the row is first selected and then deselected. You can see that it is first selected because of a the blue background occurs for a short time.
I have set
self.clearsSelectionOnViewWillAppear = NO;
but that does not work ether. Can someone help me out please! Thanks in advance.
Here some sample code:
#import "ECTESTTableViewController.h"
#interface ECTESTTableViewController ()
#end
#implementation ECTESTTableViewController
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.clearsSelectionOnViewWillAppear = NO;
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return 8;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
//cell.backgroundColor = [UIColor redColor];
}
if (indexPath.row == 1)
{
// cell.accessoryType = UITableViewCellAccessoryCheckmark;
NSLog(#"select %d", indexPath.row);
cell.selected = TRUE;
}
else {
// cell.accessoryType = UITableViewCellAccessoryNone;
cell.selected = FALSE;
}
cell.textLabel.text = [NSString stringWithFormat:#"row %d", indexPath.row];
return cell;
}
#end
If you want to programatically select a row in a UITableView use:
- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition
Don't be setting the selected states of the cells.
Write following code
NSIndexPath *indexPath = [tableView indexPathForSelectedRow];
[tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition: UITableViewScrollPositionNone];
I have TableView and in this TableView I'm printing articles. Now user must click in navigation bar item to update(download more articles from web over json). I want and I think that is better that when user scroll to bottom that automaticaly shows loading cell and start to loading or getting more articles from web.
My questions are next:
How to put that extra cell in which would appear loading indicator
and loading text How to automatically get more articles?
This functionality is in iphone app "App Store" but with click load more items.
Maybe is better to put button load more articles?
All examples and suggestions are welcome.
Thank's for help
This one is easy it's add an UITablecell at the end to load more items.
//
// TableViewController.m
// PartialTable
//
// Created by Abizer Nasir on 07/07/2011.
//
#import "TableViewController.h"
#define kNumberOfItemsToAdd 8
#implementation TableViewController
#synthesize items;
// Mark: -
// Mark: Set up and tear down
- (id)init {
// New designated initialiser
if (!(self = [super initWithStyle:UITableViewStyleGrouped])) {
return nil; // Bail!
}
numberOfItemsToDisplay = kNumberOfItemsToAdd; // Show 10 items at startup
return self;
}
- (id)initWithStyle:(UITableViewStyle)style {
// Call out to the new designated initialiser
return [self init];
}
- (void)dealloc {
[items release];
[super dealloc];
}
#pragma mark - View lifecycle
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
if (numberOfItemsToDisplay == [items count]) {
return 1;
}
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0) {
return numberOfItemsToDisplay;
} else {
return 1;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"ItemCell";
// If the indexPath is less than the numberOfItemsToDisplay, configure and return a normal cell,
// otherwise, replace it with a button cell.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
if (indexPath.section == 0) {
cell.textLabel.text = [items objectAtIndex:indexPath.row];
cell.textLabel.textAlignment = UITextAlignmentLeft;
cell.textLabel.textColor = [UIColor blackColor];
cell.textLabel.font = [UIFont boldSystemFontOfSize:17.f];
} else {
cell.textLabel.text = [NSString stringWithFormat:NSLocalizedString(#"Next %d items", #"The text to display to load more content"), kNumberOfItemsToAdd];
cell.textLabel.textAlignment = UITextAlignmentCenter;
cell.textLabel.textColor = [UIColor colorWithRed:0.196f green:0.3098f blue:0.52f alpha:1.f];
cell.textLabel.font = [UIFont boldSystemFontOfSize:14.f];
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 1) {
NSUInteger i, totalNumberOfItems = [items count];
NSUInteger newNumberOfItemsToDisplay = MIN(totalNumberOfItems, numberOfItemsToDisplay + kNumberOfItemsToAdd);
NSMutableArray *indexPaths = [[NSMutableArray alloc] init];
for (i=numberOfItemsToDisplay; i<newNumberOfItemsToDisplay; i++) {
[indexPaths addObject:[NSIndexPath indexPathForRow:i inSection:0]];
}
numberOfItemsToDisplay = newNumberOfItemsToDisplay;
[tableView beginUpdates];
[tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationTop];
[indexPaths release];
if (numberOfItemsToDisplay == totalNumberOfItems) {
[tableView deleteSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationTop];
}
[tableView endUpdates];
// Scroll the cell to the top of the table
if (newNumberOfItemsToDisplay < totalNumberOfItems) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 200000000), dispatch_get_main_queue(), ^(void){
[tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
});
[tableView deselectRowAtIndexPath:indexPath animated:YES];
} else {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 200000000), dispatch_get_main_queue(), ^(void){
[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:totalNumberOfItems-1 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
});
}
}
}
#end
Q1: add 1 more cell for load more status:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return cellsCount <= 0 ? 0 : cellsCount + 1;
}
and create load more cell:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == cellsCount) {
if (loadMoreCell == nil) {
self.loadMoreCell = [[LoadMoreTableCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:#"LoadMoreCellIdentifier"];
}
return loadMoreCell;
}
...
}
You can custom LoadMoreTableCell as you want.
Q2:
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
float offset = (scrollView.contentOffset.y - (scrollView.contentSize.height - scrollView.frame.size.height));
if (offset >= 0 && offset <= 5) {
[self loadMoreData];
}
}
I also do like this thing in my app,
Here you can use AsyncImage class which is useful to download image with url in background so your tableview scroll smooth..
here two link hope this help you for download image in background...
1.https://github.com/Koolistov/Image-Cache
2.https://github.com/rs/SDWebImage
2nd thing you want to download at bottom to another data and cell then here if you use 1 condition then its work which you like...
in cellForRowAtIndexPath tableview Delegate Method
if(indexPath.row==[yourArray count]-1){
.....do somthing which you like.....(Reload table with your json or another data)
}
here only simple logic other wise better idea is put button at your last row...
Hope this help you..
:)
I'm new to developing iOS applications and Objective C itself, so I have a probably very simple question.
Currently I have the following method that is called from a ToolBar Button click. The method is designed to create a table view in the frame variable fr.
- (IBAction)addGolfer:(id)sender {
CGRect fr = CGRectMake(101, 45, 100, 416);
UITableView *tabrleView = [[UITableView alloc]
initWithFrame:fr
style:UITableViewStylePlain];
tabrleView.autoresizingMask =
UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleWidth;
tabrleView.delegate = self;
tabrleView.dataSource = self;
[tabrleView reloadData];
self.view = tableView;
}
The result of calling this method is not what I expect. Instead of creating the Table View in the frame "fr", the table view fills the entire screen.
Again I'm totally new and would a appreciate any answers and any suggestions. Thanks!
When you set dataSource and delegate properties for your UITableView, it means, you have to write at least this methods for dataSource:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
If you wouldn't do this, it will be crash. Summary you'll get this (this code may contain syntax or logic errors - I wrote it in notepad):
#interface YourViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> {
UITableView *firstTableView;
UITableView *secondTableView;
}
#end
//
#implementation YourViewController
#pragma mark - Objects Processing
- (void)addGolfer:(UIBarButtonItem *)sender {
if (secondTableView) {
[secondTableView removeFromSuperView];
secondTableView = nil;
}
secondTableView = [[UITableView alloc] initWithFrame:CGRectMake(101, 45, 100, 416)];
secondTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
secondTableView.delegate = self;
tabrleView.dataSource = self;
[self.view addSubview:secondTableView];
}
#pragma mark - TableView DataSource Implementation
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (tableView == firstTableView) { // your tableView you had before
return 20; // or other number, that you want
}
else if (tableView == secondTableView) {
return 15; // or other number, that you want
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.backgroundView = [[UIView alloc] init];
[cell.backgroundView setBackgroundColor:[UIColor clearColor]];
[[[cell contentView] subviews] makeObjectsPerformSelector:#selector(removeFromSuperview)];
if (tableView == firstTableView) { // your tableView you had before
// ...
}
else if (tableView == secondTableView) {
cell.titleLabel.text = [NSString stringWithFormat:#"Cell %d", indexPath.row + 1];
}
return cell;
}
#end
Step 1: Add delegate UITableViewDataSource,UITableViewDelegate
#interface viewController: UIViewController<UITableViewDataSource,UITableViewDelegate>
{
UITableView *tableView;
}
Step 2:
-(void)viewDidLoad
{
tableView=[[UITableView alloc]init];
tableView.frame = CGRectMake(10,30,320,400);
tableView.dataSource=self;
tableView.delegate=self;
tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
[tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:#"Cell"];
[tableView reloadData];
[self.view addSubview:tableView];
}
Step 3: Properties for tableview (rows & column)
//-- For no of rows in table
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
//-- Table header height if needed
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 50;
}
//-- Assign data to cells
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath] ;
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text=[your_array objectAtIndex:indexPath.row]; ***(or)*** cell.textLabel.text = #"Hello";
return cell;
}
//-- Operation when touch cells
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Your custom operation
}
Instead of setting the view of the UIViewController, add the tableView as a subview.
Instead of:
self.view = tableView;
Do this:
[self.view addSubview:tableView];
This will properly respect the frame that you set.
I have UITableView with custom table row. What I need is to have possibility to reorder rows. so in ViewDidLoad i add:
- (void)viewDidLoad {
[super viewDidLoad];
[self.myTableView setEditing: YES animated: YES];
}
also add next methods:
- (BOOL)tableView:(UITableView *)tableView
canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView
editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleNone;
}
- (BOOL)tableView:(UITableView *)tableView
shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}
- (BOOL)tableView:(UITableView *)tableView
canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
Also I set bg color for my custom table row:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *customTableRow = #"customTableRow";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
customTableRow];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:#"customTableRow"
owner:self options:nil];
if (nib.count > 0) {
cell = self.customTableRow;
}
}
cell.contentView.backgroundColor = [UIColor colorWithRed:(228.0f/255.0f)
green:237.0f/255.0f blue:244.0f/255.0f alpha:1.0];
return cell;
}
And then I run my app and I had an unexpected view:
So I have tow questions:
1.So why it so ? Reorder button is not transparent ??
2.How to change that button to my on image ??
The problem is that you're changing the background color of the contentView. Have you tried changing the background color of the cell itself in -tableView:willDisplayCell: forRowAtIndexPath:?
Well something is wrong but i dont know what. I cannot delete a row . when my tableview get in editmode red minus signs near all rows appear . touch on them make to appear delete button on row , whem i touch it it become (dark red) and nothing happens.
here is my code (not all) + i have no errors and warnings at compilation and runtime ...
- (void)viewDidLoad {
[super viewDidLoad];
// initialize singleton.
appDelegate = (ExchangedAppDelegate *)[[UIApplication sharedApplication]delegate];
// get banks from settings.plist
NSString *tempPath = [self getPathOfSettingsPlist];
appDelegate.banks = [[NSArray alloc]initWithContentsOfFile:tempPath];
navigationItem.rightBarButtonItem = self.editButtonItem;
backButton = [[UIBarButtonItem alloc]initWithTitle:#"Back" style:UIBarButtonSystemItemCancel target:self action:#selector(closeSettingsView)];
navigationItem.leftBarButtonItem = backButton;
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
[banksTableView setEditing:editing animated:animated];
if (editing) {
addButton = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:#selector(addBankFromList)];
navigationItem.leftBarButtonItem = addButton;
} else {
navigationItem.leftBarButtonItem = backButton;
NSString *tempPath = [self getPathOfSettingsPlist];
self.picker.hidden = YES;
[appDelegate.banks writeToFile:tempPath atomically:YES];
}
}
- (void)addBankFromList {
// not interesting
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [appDelegate.banks count];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"BanksTableCell";
indexForPath = indexPath;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
cell.selectionStyle = UITableViewCellEditingStyleNone;
}
cell.textLabel.text = [appDelegate.banks objectAtIndex:indexPath.row];
return cell;
}
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle) editingStyle: forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[appDelegate.banks removeObjectAtIndex:indexPath.row];
[banksTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight];
[banksTableView reloadData];
}
}
//// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
NSString *temp = [appDelegate.banks objectAtIndex:fromIndexPath.row];
[appDelegate.banks removeObjectAtIndex:fromIndexPath.row];
[appDelegate.banks insertObject:temp atIndex:toIndexPath.row];
}
Actually you have added an extra colon(":") in the commitEditingStyle: method name. Adding the extra colon has made this method a completely different method. So, your view controller thought that you haven't implemented the commitEditingStyle: method and didn't do anything while you edit your table view.
Just remove the colon(":") after editingStyle in the commitEditingStyle: method. That will fix the problem. That line should look like this,
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle) editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath