아이폰어플개발정보2010. 10. 23. 14:51
[아이폰 앱 개발] warning: X may not reposnd to Y 관련
Originally Posted by occular 
I'm just wondering what the usual way is of fixing "warning: X may not reposnd to Y" warnings?

I can see what the problem is, just not sure of the best way to fix it...
This is a method in a controller of mine that subclasses UIViewController:

- (void)viewWillAppearBOOL)animated {
[[self view] setupAnimation];
}

The '[self view]' gives us the "UIView view" field inherited from UIViewController, and the compiler of course can't tell that the UIView in question responds to the setupAnimation message.

So what is the best way to fix this situation?
Would adding a selector check be the way forward?

thanks!
Ok, so it turns out that plain old casting is fine as the solution:

[(MyView*)[self view] setupAnimation];

For some reason I got it into my head that casting wasn't the objective c 'way' or something, but apparently that is not the case!
Posted by 오늘마감

댓글을 달아 주세요

아이폰어플개발정보2010. 10. 12. 06:33
imageView 의 좌표, CGPoint 구조체 center 의 x, y
자바개발했던사람들이 초기에 적응하기어려운것이 객체안에 구조체가 들어가있는 것일 것이다.
더 웃긴 것은, 
float x = fireBall.center.x;이런식으로 x값을 빼내는 것은 가능한데 반대로
fireBall.center.x=x하면 오류가 난다는 점일 것이다.

구조체인데 읽기는 가능한데 셋을 할땐, 저런식으로 하면 안되겠다.
익숙해져야한다. 
읽은땟,x, y각각이면서
쓸땐 동시에 해줘야한다는것 
즉 fire.center=CGPoint(x,y);

또한가지는, 형태는 객체랑 비슷하지만, 선언시 pointer가 붙으면 안된다. 스칼라인 int, BOOL같이 값만 가진다.

CGPoint point;
Posted by 오늘마감

댓글을 달아 주세요