にUITabelView
との異なるview
のボタンを調整する移動可能な行があります。 行を移動すると、view
のアイコンが更新されます。 ([self refreshicons]
に気づく)以下を参照してください:UIButtonとUILabelがビューの外でUIButtonから更新されていない
-(void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{
NSInteger sourceRow = sourceIndexPath.row;
NSInteger destRow = destinationIndexPath.row;
id object = [shortcutApps objectAtIndex:sourceRow];
[shortcutApps removeObjectAtIndex:sourceRow];
[shortcutApps insertObject:object atIndex:destRow];
[tableView reloadData];
[self refreshIcons];
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:shortcutApps forKey:@"ShortcutArray"];
}
これは[self refreshicons]
-(void)refreshIcons{
icon1 = [shortcutApps objectAtIndex:0];
NSLog(@"%@",icon1);
[extraIcon1 setImage:[UIImage imageNamed:[[icon1 lowercaseString] stringByReplacingOccurrencesOfString:@" " withString:@""]] forState:UIControlStateNormal];
extraIconLabel1.text = icon1;
NSLog(@"%@",extraIconLabel1);
}
あるNSLogsは、正しい文字列を印刷しますが、UILabelのとUIButton画像が更新されていません。アイコンが同じview
にある[self refreshicons]
と同じコードを実行するボタンを作成すると、コードは必要に応じて機能します。しかし、行が移動されたり、ボタンがボタンの外側に押されたりすると、ラベルとボタンは更新されません。view
考えますか?
あなたはより良いアイデアを得るためにいくつかのスクリーンショットを投稿できます – harshitgupta
なぜ 'reloadData'を' moveRowAtIndexPath: 'メソッドから呼び出すのですか? – rmaddy
@rmaddy私のテーブルビューには、インデックス番号に応じて色を変更する必要がある行があるため、 – Manesh