2011-09-16 2 views
1

내가 notificationCenter의 속성을 가진 클래스가,이 서명하는 방법 구현하는 경우 :올바른 양식

:

-(void)doSomethingWithNotificationCenter:(NSNotificationCenter *)notificationCenter 

엑스 코드는 바로 나에게 오류를 제공을

'local declaration of notificationCenter hides instance variable'

그래서 Objective C에는이 충돌을 피하기 위해이 매개 변수의 이름을 지정하는 규칙이 있습니까?

답변

3

매개 변수는 aNotificationCenter 또는 가능하면 aCenter이라고해야합니다.

0

때로는 receivedNotificationCenter 또는 notificationCenterParam 형식을 사용합니다.

1

이것은 개인적인 취향처럼 보입니다. 위에서 언급 한 것처럼 NotificationCenter, NotificationCenter, NotificationCenter 등을 보았습니다. 나는 당신이 당신 자신의 코드에서 일관성이 있다면 기본적이고 읽을 수있는 선택은 괜찮다고 생각한다.

PS - 내 개인적인 취향은 노트 센터입니다.