返り値の異なるメソッドを呼び分ける
公開日:
:
最終更新日:2014/01/30
cocoa
記事内に広告を含む場合があります。記事内で紹介する商品を購入することで、当サイトに売り上げの一部が還元されることがあります。
// 選択レイヤの動きのアニメーション化
-(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];
};
MenuView.m:160: warning: multiple methods named '-position' found
NSScriptObjectSpecifiers.h:191: warning: using '-(NSInsertionPosition)position'
CALayer.h:598: warning: also found '-(CGPoint)position'
MenuView.m:160: error: incompatible type for argument 1 of 'setPosition:'
[[[menusLayer sublayers]
objectAtIndex:selectedIndex] position]
この “position”の呼び出しが曖昧なのか。どうやって呼びわければいいのだろう??
関連記事
- PREV
- Cocoaに関する新しめの洋書をリストアップしてみた
- NEXT
- positionについて調べる