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?
UIApplicationDelegate
has these two methods.And there are
Notifications
too.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
AppDelegate
file. 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
ViewController
to be notified when the change occurs, one option, is to send notifications. Like thisFirst, add this property/variable on
AppDelegate
then, implement
willChangeStatusBarFrame
And we're done with the base of our
Status Bar Frame Checker
. The next part you implement on anyViewController
that 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
ViewDidLoad
method.In ObjC
And implement this method
In Swift