Cocos2D doesn't offer any kind of collision detection. What you want is a ray vs polygon intersection test, that's something you can do with Box2D or Chipmunk. Both are included in Cocos2D (for iPhone). Box2D and Chipmunk allow for implementation of the game physics like gravity, wind, collision detection etc.
If you require to do a 'sort of' detection in plain Cocos2D then I recommend the use of CGRectContainsCGRect or CGRectContainsCGPoint or CGRectIntersectsCGRrect functions to do the same. This may help you achieve what you want but it won't be as nice as the use of Box2D or Chipmunk game physics.