Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-22-2011, 01:20 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 5
jhoney is on a distinguished road
Default Delete a particular cell in UITableView.

how can i delete that particular cell in that tableview.....
i already used a code to delete the cell.....
i have given the code below...when i try to run the program using the code...it crases...please help me some one....i don know even wat is the mistake i have done....pls help me....

the code is
[self.statDataTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];

it crashes. wats wrong in this code?....help me pls.....
jhoney is offline   Reply With Quote
Old 09-22-2011, 01:22 AM   #2 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

You also need to delete the corresponding data in your data source.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 09-22-2011, 08:05 AM   #3 (permalink)
Knows SQL
 
iisword's Avatar
 
Join Date: Oct 2009
Location: Somewhere the streets are on fire, the sewers are flooded, and the cats are high on catnip
Posts: 529
iisword is on a distinguished road
Default

To start, you need to get rid of the NSArray part and put indexPath.row. Might need more code after that.
__________________
iisword is offline   Reply With Quote
Old 09-22-2011, 09:01 AM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Quote:
Originally Posted by iisword View Post
To start, you need to get rid of the NSArray part and put indexPath.row.
Uh, you sure about that?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-22-2011, 12:54 PM   #5 (permalink)
Knows SQL
 
iisword's Avatar
 
Join Date: Oct 2009
Location: Somewhere the streets are on fire, the sewers are flooded, and the cats are high on catnip
Posts: 529
iisword is on a distinguished road
Default

yeah thought it said path not paths

Any error messages you can show us?
__________________

Last edited by iisword; 09-22-2011 at 01:04 PM.
iisword is offline   Reply With Quote
Old 09-22-2011, 01:03 PM   #6 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 194
mavrik5150 is on a distinguished road
Default

Quote:
Originally Posted by jhoney View Post
how can i delete that particular cell in that tableview.....
i already used a code to delete the cell.....
i have given the code below...when i try to run the program using the code...it crases...please help me some one....i don know even wat is the mistake i have done....pls help me....

the code is
[self.statDataTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];

it crashes. wats wrong in this code?....help me pls.....
You first need to delete the item from the source, so either remove the corresponding object from the array first and then execute this code to remove the Cell, if not then you are going to crash since the number of rows in the table wouldn't match your data source count. So before this line you should have something like
Code:
[myDataSource removeObjectAtIndex:indexPath.row];
Then you can delete the row from the tableview with what you already have above.

Where are you performing this code as well?
mavrik5150 is offline   Reply With Quote
Old 09-23-2011, 01:01 AM   #7 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 5
jhoney is on a distinguished road
Default

wow the code you have given is working....thanks a lot mavrik5150.....thank you very much....

Last edited by Rhade; 09-23-2011 at 07:26 AM. Reason: Removed portion that is now another thread
jhoney is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 395
14 members and 381 guests
7twenty7, eski, EvilElf, HemiMG, iOS.Lover, jarv, n00b, pbart, Pudding, sacha1996, Sami Gh, UMAD, VinceYuan, yuncarl28
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,672
Threads: 94,121
Posts: 402,905
Top Poster: BrianSlick (7,990)
Welcome to our newest member, yuncarl28
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:15 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0