Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
タイトルの説明通り。
セレクターが2回呼び出されないように、重複したオブザーバーの追加を防ぎたい。
いいえ、できません。removeObserverオブザーバーを追加する直前にメソッドを呼び出して、それを2回追加していないことを確認するかNSNotificationCenter、すべてのオブザーバーを自分でサブクラス化して登録することができます。
removeObserver
NSNotificationCenter
PSオブザーバーを2回追加しようとしましたか?セレクターも 2 回呼び出されていますか?