iは目的を使ってiOSアプリケーションを開発しています。私のアプリでは、ユーザーが登録されていない場合、レジスタビューコントローラはrootViewController
です。ユーザーが登録している場合、tabBarController
は3つのタブを持つrootViewController
です。どのビューコントローラからもtabBarItem
バッジ値を設定する必要があります。私が3番目のタブにあり、それが別のView ControllerとSegueを持っていて、私がそのView Controller上にいるとすれば、ここから最初のView ControllerのtabBarItem
バッジ値を変更する必要があります。私はviewwillappearでiOS tabBarItem任意のビューからのバッジ値の変更
NSString *upcomingcount=[NSString stringWithFormat:@"%lu",(unsigned long)self.arrbadge.count];
self.navigationController.tabBarItem.badgeValue=upcomingcount;
を使用していて、私の場合にはtabBarItem
バッジ値更新のみ私はそのタブに移動します。
badgeValueを任意のViewController
から設定する方法はありますか? 0からのバッジ値を更新したいViewController
を作成するすべてのViewControllerにこの方法 アプリデリゲートに使用するために
を、このメソッドを使用!バッジの更新は、そのビューコントローラに行った場合にのみ行われます。応答のためにありがとう – goks
実際に私はまた、他の方法ラウンドを試みた。作成したView ControllerのプロトコルとそのメソッドをAppDelegate.mに委譲し、現在のView Controllerの.hファイルをAppDelegate.hにインクルードしてプロトコルを宣言し、xcodeでプロトコルの宣言が見つかりません。 .... "" "。" – goks
あなたの答えから考えていただきありがとうございました...現在作業中です – goks