我正在使用分視控制器的應用程序,並支持所有的方向。但是在橫向模式下,我添加到detailview上的一個按鈕不起作用,所以我想知道如何找出當前的代表是什麼,以便我可以發送一個命令來執行該操作。我如何找到當前的代表?
更新
基本上按鈕(在detailVC)應該更改masterVC的VC?也許不是基本的,但它不應該很難做到?
我正在使用分視控制器的應用程序,並支持所有的方向。但是在橫向模式下,我添加到detailview上的一個按鈕不起作用,所以我想知道如何找出當前的代表是什麼,以便我可以發送一個命令來執行該操作。我如何找到當前的代表?
更新
基本上按鈕(在detailVC)應該更改masterVC的VC?也許不是基本的,但它不應該很難做到?
如果你的要求方向的情況下再
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if(orientation == 0) //Default orientation
//UI is in Default (Portrait) -- this is really a just a failsafe.
else if(orientation == UIInterfaceOrientationPortrait)
//Do something if the orientation is in Portrait
else if(orientation == UIInterfaceOrientationLandscapeLeft)
// Do something if Left
else if(orientation == UIInterfaceOrientationLandscapeRight)
//Do something if right
否則的話,我想更多地瞭解您的詳細問題(什麼確切的委託你找)
'self.delegate'? – sbarow 2014-09-04 08:43:08
http://stackoverflow.com/a/5183349/1083921這會給你你的按鈕的動作和目標。 – Marc 2014-09-04 12:16:01
[How to get UIButton Target,Action and Control events?](http://stackoverflow.com/questions/5182860/how-to-get-uibutton-target-action-and-control-events) – Alex 2014-09-05 10:19:59