Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Kieran Robinson](https://uploads.teamtreehouse.com/production/profile-photos/528852/micro_image.jpg)
Kieran Robinson
9,411 PointsMoving swipe to delete into detail view
In my app, i have a tableview that currently uses swipe to delete. I implemented this by following the section within the diary app with Ash Furrow. however i wish to have the delete function as a button at the bottom of the detail view. Any ideas?
![Kieran Robinson](https://uploads.teamtreehouse.com/production/profile-photos/528852/micro_image.jpg)
Kieran Robinson
9,411 PointsI will use the diary app as an example. I have the list of diary entries on 'entryListViewController' and to remove one i currently swipe to delete. However on the 'edit' page of the diary app I would like a button at the bottom of the page to delete that entry?
![Ash Furrow](https://secure.gravatar.com/avatar/0ebf471a3ae8df42a84f93a7efbbdbd0?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ash Furrow
Treehouse Guest TeacherAh, that's a bit trickier. Adding the button is easy, but having it do something is the hard part. You'd need to set up a callback in the delegate protocol to delete the entry, and then immediately dismiss the edit view controller. Does that make sense?
![Kieran Robinson](https://uploads.teamtreehouse.com/production/profile-photos/528852/micro_image.jpg)
Kieran Robinson
9,411 PointsIm not quite sure what you mean, which methods would i use or remove, using the diary app as an example?
![Ash Furrow](https://secure.gravatar.com/avatar/0ebf471a3ae8df42a84f93a7efbbdbd0?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ash Furrow
Treehouse Guest TeacherAh, right, sorry. Forgot we didn't use the delegate pattern in this case. Your code to delete would look something like:
-(void)deleteEntry {
/*delete the entry*/
/*save the context*/
/*dismiss the view controller*/
}
Shouldn't be too hard. Let me know if you run into any issues.
![Kieran Robinson](https://uploads.teamtreehouse.com/production/profile-photos/528852/micro_image.jpg)
Kieran Robinson
9,411 PointsThank you! i will have a look now, is this still within 'entryListViewController' or the 'EntryViewController' where the button would be?
![Ash Furrow](https://secure.gravatar.com/avatar/0ebf471a3ae8df42a84f93a7efbbdbd0?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ash Furrow
Treehouse Guest TeacherYup – in the entry view controller.
![Kieran Robinson](https://uploads.teamtreehouse.com/production/profile-photos/528852/micro_image.jpg)
Kieran Robinson
9,411 PointsI will try it now! one last thing, i've been trying to teach myself how to add a search bar and display controller, but most of the tutorials are for older iOS versions, has anything changed in iOS 7 that would deem these tutorials useless?
![Ash Furrow](https://secure.gravatar.com/avatar/0ebf471a3ae8df42a84f93a7efbbdbd0?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ash Furrow
Treehouse Guest TeacherNo, not really. iOS 8 changes some things, but the concepts you learn will still be relevant.
![Kieran Robinson](https://uploads.teamtreehouse.com/production/profile-photos/528852/micro_image.jpg)
Kieran Robinson
9,411 Pointsthanks again!
![Kieran Robinson](https://uploads.teamtreehouse.com/production/profile-photos/528852/micro_image.jpg)
Kieran Robinson
9,411 PointsHi Ash Furrow
-(void)deleteEntry {
CoreDataStack *coreDataStack = [CoreDataStack defaultStack]; DiaryEntry *entry = [self.fetchedResultsController objectAtIndexPath:indexPath];
//delete entry
[[coreDataStack managedObjectContext] deleteObject:entry];
//save context
[coreDataStack saveContext];
//dismiss view controller
[self dismissSelf];
}
also, what methods do i take out of the entryListViewController?
![Kieran Robinson](https://uploads.teamtreehouse.com/production/profile-photos/528852/micro_image.jpg)
Kieran Robinson
9,411 Pointsnot sure why it formatted my comment that way, it won't change! hope you can still understand the method?
![Ash Furrow](https://secure.gravatar.com/avatar/0ebf471a3ae8df42a84f93a7efbbdbd0?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ash Furrow
Treehouse Guest TeacherInteresting. That should be working. What's happening instead? Can you post a project that's not working so I can take a closer look?
![Kieran Robinson](https://uploads.teamtreehouse.com/production/profile-photos/528852/micro_image.jpg)
Kieran Robinson
9,411 PointsAsh Furrow its working now! Thank you for your time
![Ash Furrow](https://secure.gravatar.com/avatar/0ebf471a3ae8df42a84f93a7efbbdbd0?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ash Furrow
Treehouse Guest TeacherAnytime!
Ash Furrow
Treehouse Guest TeacherAsh Furrow
Treehouse Guest TeacherHmm. Not quite sure what you mean. Can you elaborate?