「通常のコントローラー」とはどういう意味かわかりませんが、各 UIViewControllers の向きの変更について通知を受けたい場合はdidRotateFromInterfaceOrientation:
、カスタム通知を投稿できるメソッドを実装する抽象 UIViewController を作成できます。各 UIViewController をその抽象 UIViewController のサブクラスにするよりも。例えば。
#import <UIKit/UIKit.h>
@interface MyAbstractViewController : UIViewController
@end
@implementation MyAbstractViewController
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
[[NSNotificationCenter defaultCenter] postNotificationName:@"MyNotificationName" object:self];
}
@end
MyAbstractViewController のサブクラスとして UIViewControllers を作成します。
#import <UIKit/UIKit.h>
#import "MyAbstractViewController.h"
@interface ViewController : MyAbstractViewController
@end
必要なオブジェクトを「MyNotificationName」のオブザーバーにする
#import <Foundation/Foundation.h>
@interface MyController : NSObject
@end
@implementation MyController
-(id)init {
self = [super init];
if (self) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(vcDidChangeOrientation:) name:@"MyNotificationName" object:nil];
return self;
}
return nil;
}
-(void)vcDidChangeOrientation:(NSNotification *)notification {
UIViewController *vController = (UIViewController *)[notification object];
//Do whatever you want to do with it
}
@end