你好,我在指定應用delegate.m的方法nsnotifiaction這個方法調用eprox每30秒,我想在視圖 - 控制其notifcation ADN執行方法, 這裏是我的appdelegate .MNSNotification不視圖控制器從的appDelegate
的代碼- (void)layoutAnimated:(BOOL)animated{
BOOL yy= self.bannerView.bannerLoaded;
if (yy==1){
self.iAdString=[NSMutableString stringWithString:@"1"];
[[NSNotificationCenter defaultCenter] postNotificationName:@"BannerViewActionWillBegin" object:self];
}
else{
self.iAdString=[NSMutableString stringWithString:@"0"];
[[NSNotificationCenter defaultCenter] postNotificationName:@"BannerViewActionDidFinish" object:self];
}
}
和viewcontroller.m
// i的viewDidLoad方法定義
- (void)viewDidLoad{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willBeginBannerViewActionNotification:) name:@"BannerViewActionWillBegin "object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFinishBannerViewActionNotification:) name:@"BannerViewActionDidFinish" object:nil];
}
其方法是1..
- (void)willBeginBannerViewActionNotification:(NSNotification *)notification{
[self.view addSubview:self.app.bannerView];
NSLog(@"come");
}
- (void)didFinishBannerViewActionNotification:(NSNotification *)notification {
NSLog(@"come");
[self.app.bannerView removeFromSuperview];
}
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
在appdelegate文件中讀取方法時,我沒有得到多餘的方法的響應。
請幫幫我。
在applegate顯示一個alertview,每當你收到一個警報,並使該alertview子視窗,使我們會得到警報各自的視圖 – 2013-04-08 06:41:17