Telefon görüşmesi sırasında görüşümün yeşil çubuğun altında görünmesini nasıl sağlayabilirim? Şu anda benim app bir telefon görüşmesi sırasında yeşil çubuk tarafından kısmen kaplıdır. EğerTelefon görüşmesi sırasında yeşil çubuğun altında görünüm nasıl konumlandırılır?
- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameChanged:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameWillChange:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
}
- (void)statusBarFrameWillChange:(NSNotification*)notification {
NSValue* rectValue = [[notification userInfo] valueForKey:UIApplicationStatusBarFrameUserInfoKey];
CGRect newFrame;
[rectValue getValue:&newFrame];
NSLog(@"statusBarFrameWillChange: newSize %f, %f", newFrame.size.width, newFrame.size.height);
// Move your view here ...
}
- (void)statusBarFrameChanged:(NSNotification*)notification {
NSValue* rectValue = [[notification userInfo] valueForKey:UIApplicationStatusBarFrameUserInfoKey];
CGRect oldFrame;
[rectValue getValue:&oldFrame];
NSLog(@"statusBarFrameChanged: oldSize %f, %f", oldFrame.size.width, oldFrame.size.height);
// ... or here, whichever makes the most sense for your app.
}
UIKit uzantılarını şu şekilde kullanabilirsiniz: CGRect newFrame = [rectValue CGRectValue]; - öyle ya da böyle! –
Sadece eklemek istiyorum, NSLog ve adlandırma kuralı biraz yanlış. statusBarFrameWillChange statusBarFrameChanged öğesinden önce çağrılır, böylece statusBarFrameWillChange öğesinden bildirim gerçekte OLD değeri olacak ve yeni değer olmayacaktır. Diğer yöntemle tersi. – micnguyen