我是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