我是mac开发新手。这是我的代码,但我不明白这个警告。请帮帮我。我发现这种方法的警告。找到多个名为'state'的方法?
- (IBAction)toggleFiles:(id)sender
{
NSRect frame = [oWindow frame];
NSRect contentRect = [oWindow contentRectForFrameRect:frame];
float titlebarHeight = NSHeight(frame) - NSHeight(contentRect);
NSSize newSize = [sender state] == NSOnState ? sFilesExpandedSize : sFilesCollapsedSize;
frame.origin.y -= newSize.height - contentRect.size.height;
frame.size = newSize;
frame.size.height += titlebarHeight;
[oWindow setFrame:frame display:YES animate:YES];
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:(int) [sender state] == NSOnState]
forKey:@"DisplayFiles"];
}
这里找到了这个警告 - 找到了多个名为'state'的方法。如何解决这个问题。请帮帮我。
什么是发件人的类型? – CRDave
Duck typing Vs Xcode 4. – uchuugaka