關鍵我已經做了如下變化值在字典
NSDictionary *dic=[[NSDictionary alloc] initWithObjectsAndKeys:a1,@"0",a2,@"1",a3,@"2",a4,@"3", nil];
NSDictionary *userbtn=[[NSDictionary alloc] initWithObjectsAndKeys:dic,@"button", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:userbtn];
我想改變的關鍵,當我在tableview中移動單元格。 我發現鑰匙的價值不能改變。
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
{
NSUInteger fromRow = [sourceIndexPath row];
NSUInteger toRow = [destinationIndexPath row];
}
我該怎麼辦......在上述方法中。
恩......非常感謝。我犯了一個錯誤,我忘了NSMutableDictionary。我在NSDictionary中存儲數據...所以...許多方法是有限的。 – user1535023 2012-07-20 05:49:17
您只需將fromRow與toRow交換即可。那麼從哪裏來的數據呢?它讓我陷入困境。字典不像數組那樣靈活......僅僅因爲它的數據擁有一把鑰匙....... – user1535023 2012-07-20 07:11:39
e ....我修好了它。沒有別的難題 – user1535023 2012-07-20 07:43:04