PDA

View Full Version : Configuring App view correctly when iPhone has active call




jsnuff1
Mar 11, 2009, 12:28 AM
How would I go about decting whether my App is launched while a user is on a phone call? Right now my whole view is shifted down by the green bar on top while on a call, so a bottom portion of my view is blocked off.

I can reconfigure my view correctly if I know when a user is on a call, but I cant seem to find a way to know that.



harry65
Oct 3, 2009, 02:24 PM
Instead of creating a new thread for my question, I actually searched first for an answer... I could not find the answer, but found the question.

I would also like to be able to determine if a phone call is in progress or not. I'd like to be able to be in a phone call and then start and use my app. However, if I am currently in a phone call I have to set up my view differently, so I figured I'd resurrect this old post.

Does anyone know if it's possible to determine if that green 'phone-call-bar' is currently displayed or not?

Thanks

robbieduncan
Oct 3, 2009, 02:29 PM
If you setup the autosizing mask (springs/rods in IB) then it'll happen automatically (or should).

harry65
Oct 3, 2009, 02:43 PM
Thanks robbieduncan. I do have the auto-resizing stuff set up correctly so my view will scale when it gets resized.

I have another issue, though. I have a bunch of elements in specific locations in my app and I handle the touches myself by looking at the touch and comparing it to where I know my element is on the screen. When my view auto-resizes, the element is no longer where is 'should be', so my touch-detecting code does not work correclty.

Not sure if this makes sense or not, but if anyone has any ideas I'm open to suggestions!

Thanks.

robbieduncan
Oct 3, 2009, 04:20 PM
Thanks robbieduncan. I do have the auto-resizing stuff set up correctly so my view will scale when it gets resized.

I have another issue, though. I have a bunch of elements in specific locations in my app and I handle the touches myself by looking at the touch and comparing it to where I know my element is on the screen. When my view auto-resizes, the element is no longer where is 'should be', so my touch-detecting code does not work correclty.

Not sure if this makes sense or not, but if anyone has any ideas I'm open to suggestions!

Thanks.

You should not be assuming the position: read it from the element at the time of the touch.

harry65
Oct 3, 2009, 06:52 PM
@robbieduncan - I was not quite clear in my last post. The elements I was talking about really aren't elements/objects at all - I simply draw them using CoreGraphics in my view's drawRect method, so they don't know where they are located at. And, actually, if I don't do the scaling stuff (UIViewContentModeScaleAspectFit) they will still be located in the 'correct' spot relative to my view, but I still have the issue of needing to draw my view differently when a phone-call is in session.

I realize now that it's pretty simple... I call

[self setContentMode:UIViewContentModeRedraw];

on my view so the view will get re-drawn if it resizes, and then in my drawRect method of my view I can get the size of the status bar using

[[UIApplication sharedApplication] statusBarFrame];

The height is 40 when the status bar is in the 'green-phone-call-mode'. When the caller hangs up my view will get resized, and hence redrawn thanks to the method above, and now when I get the size of the status bar it is the 20 pixels as normal and I can draw my view accordingly.

Thanks for the comments, though. It made me realize I was going about this the wrong way and got me back on track!