How do I detect if user is in-call or tethering? I have a subview for iAd like this:
_UIiAD = [[self appdelegate] UIiAD];
_UIiAD.delegate = self;
[_UIiAD setFrame:CGRectMake(0,470,320,50)];
[self.view addSubview:_UIiAD];\
And it sets it wrong when the user is in call? How do I detect this?
UIApplicationDelegatehas these two methods.And there are
Notificationstoo.but they're not posted on the launch of the app, so I wouldn't recommend it.
The simulator has an useful tool to test that.
I would suggest you to implement those methods on your
AppDelegatefile. They will be called when the status bar change it's height. One of them it's called before and the other after the change.Assuming you want that your
ViewControllerto be notified when the change occurs, one option, is to send notifications. Like thisFirst, add this property/variable on
AppDelegatethen, implement
willChangeStatusBarFrameAnd we're done with the base of our
Status Bar Frame Checker. The next part you implement on anyViewControllerthat needs to know the status bar frame.Any time you want to get the status bar frame, you do like so
And to be notified when it changes, add this to
ViewDidLoadmethod.In ObjC
And implement this method
In Swift