chabashilah
chabashilah

Reputation: 201

Unknown UITableViewCellStateMask value when willTransitionToState is called

In API document, cell state mask document is defined as

enum {
   UITableViewCellStateDefaultMask                     = 0,
   UITableViewCellStateShowingEditControlMask          = 1 << 0,
   UITableViewCellStateShowingDeleteConfirmationMask   = 1 << 1
};

However, when I push minus button when UITableView is in edit mode, argument of willTransitionToState is 3

- (void)willTransitionToState:(UITableViewCellStateMask)state{
    [super willTransitionToState:state];
    if(state == 3){
        //When minus button is pushed, value of state is 3
    }
}

Where can I find the definition?

Upvotes: 4

Views: 878

Answers (1)

Mundi
Mundi

Reputation: 80265

This is expected behavior.

The UITableViewCellStateShowingEditControlMask (A) is set to true. That is logical because you can still see the edit control. UITableViewCellStateShowingDeleteConfirmationMask (B) is also set to true, as you just pushed the minus button.

Thus,

(A) = 1 << 0 = 1   00000001
(B) = 1 << 1 = 2   00000010
----------------------------
(A) + (B)    = 3   00000011

Upvotes: 5

Related Questions