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, 2022 in IOS by Soham
• 9,710 points
335 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, 2022 in IOS by Rahul
• 9,680 points
2,102 views
0 votes
0 answers

How to access and read a file on a USB drive from IOS? (Connected via OTG cable to iPhone)

Can I access a text file on ...READ MORE

Nov 7, 2022 in IOS by Soham
• 9,710 points
563 views
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, 2022 in IOS by Aditya
• 7,680 points
4,484 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, 2022 in IOS by Rahul
• 9,680 points
854 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, 2022 in IOS by Rahul
• 9,680 points
626 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, 2022 in IOS by Soham
• 9,710 points
720 views
0 votes
0 answers

iPhone system font

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

May 16, 2022 in Others by Kichu
• 19,050 points
485 views
0 votes
1 answer

iPhone system font

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

answered Sep 20, 2022 in Others by Aditya
• 7,680 points
1,369 views
0 votes
1 answer

Getting country calling prefix

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

answered Sep 20, 2022 in Others by Aditya
• 7,680 points
801 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, 2022 in IOS by Rahul
• 9,680 points
888 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