Angle to Mecca from current location with iPhone compass

0 votes

I am developing an iPhone application that will display both the North and Qibla directions. I am displaying the North direction with the aid of CLLocationManager and updating it with CLHeading as newHeading. magneticHeading, And using the following code, I am indicating the Qibla direction.

double A = MECCA_LONGITUDE - lon;
double b = 90.0 - lat;
double c = 90.0 - MECCA_LATITUDE;
NSLog(@"tan -1( sin(%f) / ( sin(%f) * cot(%f) - cos(%f) * cos(%f)))", A, b, c, b, A);
double qibAngle =  atan(sin(A) /( sin(b) * (1 / tan(c)) - cos(b) * cos(A) ));
NSLog(@"qib Angle- %f",qibAngle);
qibla.transform = CGAffineTransformMakeRotation(qibAngle * M_PI /180);

I'm getting the angle here, but when I rotate the device, the angle does not change. Could someone please help me? I know that I need to do something with the title, but I'm not sure what.

Sep 27 in IOS by Soham
• 9,670 points
29 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In IOS

0 votes
1 answer

How to get rid of blank space from iPhone notch on web page

You should be looking for the meta-setting ...READ MORE

answered Nov 8 in IOS by Rahul
• 9,680 points
31 views
0 votes
0 answers
0 votes
1 answer

Is it possible to run .APK/Android apps on iPad/iPhone devices?

It is not possible to run Android ...READ MORE

answered Sep 20 in IOS by Aditya
• 7,660 points
194 views
0 votes
1 answer

How is a rounded rect view with transparency done on iphone?

view.layer.cornerRadius = radius; The difficult technique is to ...READ MORE

answered Sep 22 in IOS by Rahul
• 9,680 points
40 views
0 votes
1 answer

Is there a way to to check if a picture was taken on that iPhone?

Actually, the model and manufacturer information is ...READ MORE

answered Sep 22 in IOS by Rahul
• 9,680 points
38 views
0 votes
0 answers

How to connect iphone to a local server running on mac?

I am running a django server at ...READ MORE

Sep 22 in IOS by Soham
• 9,670 points
46 views
0 votes
0 answers

iPhone system font

What is the name of the default ...READ MORE

May 16 in Others by Kichu
• 19,040 points
53 views
0 votes
1 answer

iPhone system font

The iPhone system interface uses Helvetica or ...READ MORE

answered Sep 20 in Others by Aditya
• 7,660 points
89 views
0 votes
1 answer

Getting country calling prefix

For a class that offers both this ...READ MORE

answered Sep 20 in Others by Aditya
• 7,660 points
70 views
0 votes
1 answer

Detecting iPhone 6/6+ screen sizes in point values

The device screen will be the first ...READ MORE

answered Sep 22 in IOS by Rahul
• 9,680 points
71 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP