私は新しい IOS です。NSMutableArray カウントを一時的に保存する方法を知りたいので、新しいカウントと比較できますか?
アプリにカウント付きのバッジ アイコンを追加し、新しい行をクリックすると削除されますが、更新して新しい行を追加すると、すべてのバッジが再び追加されます。
これはコードです:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:self.parseResults.count];
return self.parseResults.count;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger badge = [[UIApplication sharedApplication] applicationIconBadgeNumber];
if (badge > 0) {
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:(badge - 1)];
}
}
感謝