multiple methods named '-position' found

Shingo Satou akio0911 at gmail.com
Sat Apr 12 10:15:11 PDT 2008


I corrected the code as follows.

	selectionLayer.position = [
		(CALayer*)[[menusLayer sublayers]
		objectAtIndex:selectedIndex] position];

Warning was not displayed.

Tyank you very mach.

On Sat, Apr 12, 2008 at 6:33 PM, Christiaan Hofman <cmhofman at gmail.com> wrote:
>
>
>  On 12 Apr 2008, at 10:48 AM, Shingo Satou wrote:
>
>
> > Hi Guys,
> >
> > I wrote the following programs.
> >
> > -(void)changeSelectedIndex:(NSInteger)theSelectedIndex
> > {
> >        selectedIndex=theSelectedIndex;
> >
> >        if (selectedIndex == [names count]) selectedIndex=[names count]-1;
> >        if (selectedIndex < 0) selectedIndex=0;
> >
> >        selectionLayer.position = [[[menusLayer sublayers]
> >                objectAtIndex:selectedIndex] position];
> > };
> >
> > When I Bild it, the following errors are output.
> >
> > /Users/user/Desktop/CoreAnimationMenu/MenuView.m:160: warning:
> > multiple methods named '-position' found
> >
> /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSScriptObjectSpecifiers.h:191:
> > warning: using '-(NSInsertionPosition)position'
> >
> /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CALayer.h:598:
> > warning: also found '-(CGPoint)position'
> > /Users/user/Desktop/CoreAnimationMenu/MenuView.m:160: error:
> > incompatible type for argument 1 of 'setPosition:'
> >        /Users/user/Desktop/CoreAnimationMenu/MenuView.m:160: warning:
> > multiple methods named '-position' found
> >
> /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSScriptObjectSpecifiers.h:191:
> > warning: using '-(NSInsertionPosition)position'
> >
> /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CALayer.h:598:
> > warning: also found '-(CGPoint)position'
> >        /Users/user/Desktop/CoreAnimationMenu/MenuView.m:160: error:
> > incompatible type for argument 1 of 'setPosition:'
> >
> > I appreciate any help.
> >
> >
> > akio
> >
>
>  As the warnings say: there are several position accessors in the
> frameworks, and the compiler does not know which one to use. To avoid this
> warning you should type the selectionLayer, as in [(CALayer)[[menusLayer
> sublayers] objectAtIndex:selectedIndex] position]
>
>  Christiaan
>
>
>


More information about the MacOSX-dev mailing list