我有一個AppDelegate中,並在該聲明是CustomUIViewController.h並在控制器我已經RandomName.h宣佈(作爲一個對象,而不是一個子類)我可以使用[super methodName]或類似的從RandomName.h上的方法觸發CustomUIViewController上的方法嗎?
或者我必須將它傳遞給appDelegate然後從那裏傳遞給CustomUIViewController? (如何我已經做了)
感謝
附:咖啡很好。
我有一個AppDelegate中,並在該聲明是CustomUIViewController.h並在控制器我已經RandomName.h宣佈(作爲一個對象,而不是一個子類)我可以使用[super methodName]或類似的從RandomName.h上的方法觸發CustomUIViewController上的方法嗎?
或者我必須將它傳遞給appDelegate然後從那裏傳遞給CustomUIViewController? (如何我已經做了)
感謝
附:咖啡很好。
我想我已經理解了你的問題。請原諒我,如果我不;-)
super
不工作的方式。你可以簡單地調用,
[appDelegate.customViewController methodName];
的另一種方法是將customViewController的引用傳遞到RandomName對象,像,
[[RandomName alloc] initWithParent:self];
你必須不斷的自我參考在initWithParent方法,可以說變量名是父,並調用這樣的方法,
[parent methodName];
謝謝,這是更清潔,那麼我目前正在做的。 – Mytheral
很高興我能幫到你! – EmptyStack
確切地在項目中我正在研究這是一個爲我播放圖像序列的類。我試圖找到的另一種方法是將RandomName的「我完成動畫」值傳遞迴CustomUIView,而無需通過AppDelegate運行。 – Mytheral
對於任何查看此主題的人來說,通知中心都可以用於此目的。 – Mytheral
鏈接解釋:http://stackoverflow.com/questions/2191594/how-to-send-and-receive-message-through-nsnotificationcenter-in-objective-c – Mytheral