有沒有一種方法可以確定表單的狀態?我知道我可以調用這個方法:可可獲得表單狀態
- (void) customSheetDidClose : (NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
但我想要做的是這樣的:
- (void) getInfoMethod {
//...do a lot of stuff to gather data
[self openSheetMethod:dictionaryFullOfStuff];
//I am completely making this up
while([panFileDataEditor state] == open) {
//do nothing
}
}
- (void) openSheetMethod : (NSDictionary*) stuff {
//...do something with stuff
[NSApp beginSheet: panFileDataEditor modalForWindow: window modalDelegate: self didEndSelector: @selector(customSheetDidClose:returnCode:contextInfo:) contextInfo: nil];
}
我使用的是NSPanel我的表,我想我可以得到它的框架和檢查y位置,以確定其狀態,但我想檢查,看看是否有這樣的一個接受的方式...
我重寫了谷歌的問題,並得到了這個:BOOL hasSheet =([window attachedSheet]!= nil); – PruitIgoe 2012-02-29 18:04:40
我在google上重寫了這個問題,並得到了這個:BOOL hasSheet =([window attachedSheet]!= nil);更改我的代碼爲:while([winMain attachedSheet]!= nil){ \t \t \t NSLog(@ 「表單打開」); \t \t \t}但我不能在表單本身做任何事情 – PruitIgoe 2012-02-29 18:10:28