セルを並べ替えることができるテーブル ビューを作成しようとしています (tableView:
moveRowAtIndexPath:toIndexPath
テーブル ビュー データ ソース デリゲート メソッドを使用)。
私が書いたものは、シミュレーター (OS 3.0) では正常に動作しますが、デバイス (OS 3.0 の iPod touch) では動作しません。
ドラッグ コントロールはシミュレーターとデバイスの両方で表示され、上記のメソッドはシミュレーターとデバイスの両方で起動します。
を使用するNSLog
と、iPod では to 行と from 行が常に同じであることがわかります。
ドラッグ コントロールに触れることで行を「選択」できるようですが、上下に「ドラッグ」し始めるとすぐにコントロールが解放されます。
これがなぜなのか、誰にも考えがありますか?
-(void)tableView:(UITableView *)theTableView moveRowAtIndexPath:(NSIndexPath *)fromPath toIndexPath:(NSIndexPath *)toPath
{
NSLog(@"into move method... from:%d to:%d", [fromPath row], [toPath row]);
// Make adjustments to the favoritesArray.
NSMutableDictionary *temp = [[favoritesManager favoritesArray] objectAtIndex:[fromPath row]];
[temp retain];
[[favoritesManager favoritesArray] removeObjectAtIndex:[fromPath row]];
[[favoritesManager favoritesArray] insertObject:temp atIndex:[toPath row]];
[temp release];
}