我知道的參數發送給一個選擇,我們使用withObject
,但如何處理以下情況:如何將參數發送到選擇器?
UIBarButtonItem* backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:[[NavigatorUtil new] autorelease] action:@selector(back:) ];
背面方法是這樣的:
#import "NavigationUtil.h"
@implementation NavigationUtil
+(void) back: (UINavigationController*) navigationController
{
[navigationController popViewControllerAnimated:YES];
}
@end
現在我需要發送參數給這個選擇器?如何?
看來的'實例NavigationUtil'跨越其中要求的方法,所以我已經聲明它作爲ViewController中的實例變量和它完美的工作。謝謝。 –