調用類中的方法我有一個方法:無法通過選擇從主類
+ (id) showModalFromController: (UIViewController*) controller
{
AxEmpAuthorizationController * autorizationController = [[self.class alloc] initWithNibName:NSStringFromClass(self.class) bundle:nil];
[autorizationController performSelectorOnMainThread: @selector(showModalFromController:) withObject: controller waitUntilDone: YES];
return [autorizationController authorelease];
}
,我有一個類別AxEmpAuthorizationController+CustomLoginVC.h
在我所覆蓋的方法:
- (void) showModalFromController: (UIViewController*) controller
{
NavigationTopViewController* navigationController = [[NavigationTopViewController allocWithZone: NULL] initWithRootViewController: self];
[controller presentModalViewController: navigationController animated: ![self.class isMain]];
[navigationController release];
}
的問題在於類別中的方法永遠不會被調用,並且我找不到問題。任何幫助?
切勿使用類別來覆蓋Objective-C中的方法。這是未定義的行爲,可能不會像你希望的那樣工作。 – rmaddy 2014-10-06 17:06:10