Shake based application

Posted by Sid on Stack Overflow See other posts from Stack Overflow or by Sid
Published on 2010-06-02T08:08:30Z Indexed on 2010/06/02 8:14 UTC
Read the original article Hit count: 578

hii frnz, i am developing an application which deletes rows from a table view when the user shakes the iPhone.i have created a navigation based project. now when the user shakes the iPhone i want that the title of navigation bar should change to "DELETE" and a delete button should appear on the navigation bar on the same view (but this operation should take place only when the user shakes the iPhone )otherwise when a user selects a particular row then it should move to next view.I have written the followin code but its not working.plz help me out.....

  • (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //NSLog(@"hiiiii"); if (isShaked == NO) {

    //logic to move to next view goes here.

    }
    else {

    self.title = @"Delete Rows";
    delete=[[UIBarButtonItem alloc] initWithTitle:@"Delete rows" style:  
    

    UIBarButtonItemStyleBordered target:self action:@selector(deleteItemsSelected)] ;

             self.navigationItem.rightBarButtonItem=self.delete;
    MyTableCell *targetCustomCell = (MyTableCell *)[tableView  cellForRowAtIndexPath:indexPath];
    [targetCustomCell checkAction];
    [self.tempArray addObject: [myModal.listOfStates objectAtIndex:indexPath.row]];
    
    
    //[delete addTarget:self action:@selector(deleteItemsSelected:) forControlEvents:UIControlEventTouchUpInside];
    
    
    self.tempTableView = tableView;
    

    }

}

-(void)deleteItemsSelected { //for(int i = 0; i <= [tempArray count]; i++) //{

//}


[myModal.listOfStates removeObjectsInArray:tempArray];
[tempTableView reloadData];

}

checkAction method is a custom cell method which is used to put a tickmark on the row selected

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c