본문 바로가기
개발/Object C

UIScrollView에서 setDelegate를 사용했을 경우 warning

by belitino 2010. 8. 21.
http://stackoverflow.com/questions/2212778/why-i-can-support-zooming-a-uiscrollview-without-conforming-to-the-uiscrollviewde

UIScrollView 클래스에서 다음과 같이 setDelegate 메소드를 사용하면
[scrollView setDelegate:self];

'클래스 이름' does not implement the 'UIScrollViewDelegate' protocol 이란 warning 메시지가 나온다
이 경우 다음과 같이 바꿔주면 warning 메시지를 없앨 수 있다.

[scrollView setDelegate:(id<UIScrollViewDelegate>)self];

하지만, 아직 정확한 이유는 잘 모르겠다.