我需要在通話狀態增加了狀態欄高度40.我用- (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame
使用NSNotificationCenter
無法在通話狀態中的ios目標C
它的工作狀態時發佈通知,調整結束的觀點改變的UIView的矩形酒吧高度從20增加到40,但NSNotificationCenter似乎並沒有發佈通知,當狀態欄高度從40降低到20 UIView幀未分配給所需的CGRectMake
我正在一箇舊的項目所以沒有故事板。
這裏就是我試圖
在viewDidLoad中 -
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarChangedForBottmView:) name:@"STATUSBARCHANGED" object:self];
和方法
- (void) statusBarChangedForBottmView:(NSNotification *)notification
{
NSDictionary *data = [notification userInfo];
NSString *statusBar = [data valueForKey:@"frame"];
NSLog(@"status bar in edit card = %@",statusBar);
if ([statusBar isEqualToString:@"STATUS"])
{
if (STATUSBARINCREASED)
{
[self.bottomView setFrame:CGRectMake(0, self.view.frame.size.height-60, self.view.frame.size.width, 45)];
}
else
{
[self.bottomView setFrame:CGRectMake(0, self.view.frame.size.height-40, self.view.frame.size.width, 45)];
}
}
}
你爲什麼不乾脆使用蘋果的'UIApplicationWillChangeStatusBarFrameNotification'? – 2014-10-09 15:49:31
@GuillaumeAlgis我試過了,但沒有奏效。所以我嘗試了一些不同的東西,仍然沒有奏效。不知道爲什麼 – 2014-10-09 15:52:32
我在我的選擇器中添加了斷點,但從未被調用。任何想法爲什麼? – 2014-10-09 15:55:52