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 8605935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:58:09+00:00 2026-06-12T02:58:09+00:00

I have a table view section with two custom cells. I want to swap

  • 0

I have a table view section with two custom cells. I want to swap the cells in that section when the some other action triggers.

enter image description here

The top cell should slide to the bottom, and the bottom cell should slide to the top.

My current code results in blank cells’ area

enter image description here

when cellForRowAtIndexPath returns:

    // flag is set to YES when reloadSections is called 
    if (flag) {             

        if (self.currentAddressingMode == AddressingModeToSelf) {

                if (indexPath.row == 0) {
                    return self.outNumberCell;
                }
                else if (indexPath.row == 1) {
                    return self.inNumberCell;
                }

            }
            else if (self.currentAddressingMode == AddressingModeToCounterpart) {

                if (indexPath.row == 0) {
                    return self.inNumberCell;
                }
                else if (indexPath.row == 1) {
                    return self.outNumberCell;
                }
            }
        }

Is there a solution?

  • 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-06-12T02:58:10+00:00Added an answer on June 12, 2026 at 2:58 am

    I’ve solved this question by creating custom cells in the cellForRowAtIndexPath: method (by adding subviews to them), instead of subclassing. For animated cell swapping I used the UITableView‘s moveRowAtIndexPath:toIndexPath: method (iOS 5 SDK). The other related methods work fine too (it depends of the swapping animation that you need). The code chunk that I posted to this question remains completely unchanged.

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

Sidebar

Related Questions

I have a custom cell in a table View, see below. I have two
I have a table into wich I'd like to mix some custom cells and
I have a UIView in a table view section header that I would like
I have a table view that displays a musician's albums. Each section is an
I have 2 sections within a table view and I have loaded one section
When I have a table view with some sections which have their own headers
I have a UITableView with custom UITableViewCells. The table has two sections, the first
In my application i have a table view controller that builds a table with
I have a table view and I'm toggling its dataDource with two UIButtons (like
I am making a custom table view which has content 'Static Cells' and style

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.