Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6228027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:19:06+00:00 2026-05-24T09:19:06+00:00

I have a UITableView with draggable rows and I can add/remove items. The datasource

  • 0

I have a UITableView with draggable rows and I can add/remove items. The datasource is a NSMutableArray.

Now, if I move the row with “Add new functionality” the app crashes because the dataSource is smaller since such row has not been added yet.

So I’ve modified this code:

- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
        if (indexPath.row >= [dataList count]) return NO;
        return YES;
    }

And now I can’t move it anymore. However I can still move the other rows after such row and consequently the code crashes.

How can I solve this ? Is there a way to disable the dragging “to” specific rows and not only from ?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T09:19:07+00:00Added an answer on May 24, 2026 at 9:19 am

    This is exactly what the UITableViewDelegate method

    -tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath:

    is for. Will it suit your purposes? Here’s the documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have UITableView and it add data from NSMutableArray. So, I want to know
I have UITableView.when i click on it's 1 st row one another UITableView opens
I have a UITableView populated with a location-based datasource. I'm calling [self updateView]; to
I have a UITableView with an Index on the side; I want to add
Hi i have UITableView with x rows and my cell data loaded with plist
I have a UITableView with many rows that push a DetailViewController depending on the
I have a UITableView and I want to provide the functionality to user to
I have a UITableView and I want to add a UIView as a footer.
I have UITableView being pushed to UINavigationController. I need to add a UIToolBar to
I have a UITableView that has a disclosure button on every row. When the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.