how to delete a row in a table view

Discussion in 'iOS Programming' started by geiger10d, Mar 13, 2011.

  1. geiger10d macrumors member

    Joined:
    Jan 31, 2011
    #1
    hey guys i am trying to swipe to delete here the swipe works but when i click delete nothing happens what do i have to do !



    Code:
    - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle		
    	forRowAtIndexPath:(NSIndexPath *)indexPath {
    	
    	if (editingStyle == UITableViewCellEditingStyleDelete) {
    		
    	}
    }
    
    
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    1) Remove the row from your data model
    2) Request the table reload data (perhaps with animation)
     
  3. geiger10d thread starter macrumors member

    Joined:
    Jan 31, 2011
    #3
    how would i do that? can you show me some tutorial or explain it to me please?

    thanks
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Nope. Either way you will simply copy and paste and I believe that is the worst possible outcome. Furthermore it depends explicitly on how you have coded your data model which we don't know. For 2) you should be able to find out in seconds from the documentation.
     
  5. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #5
    Google search terms:
    uitableview delete row tutorial
    uitableview delete row example
    uitableview delete row sample


    Also see:
    http://whathaveyoutried.com/
     
  6. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    What a fantastic website. That encapsulates the attitude of at least 80% of the posters asking questions on here: lazy with a massively unpleasant sense of entitlement.
     
  7. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #7
  8. RonC macrumors regular

    Joined:
    Oct 18, 2007
    Location:
    Chicago-area
    #8
    Here's a good learning resource

    a) I agree - the OP needs to LEARN how the APIs work, not EXPECT someone to hand out an answer. I'm not sure that the OP intended the latter, btw, but...

    b) I've given this link out before - see my response in this thread for links to some good information. Lecture #10 covers TableView pretty thoroughly.

    RonC
     

Share This Page