Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7774773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:27:40+00:00 2026-06-01T17:27:40+00:00

I have created one application in which i want to display compass.but my application

  • 0

I have created one application in which i want to display compass.but my application is showing me blank page..I have added CoreLocation framework also..Please help me to display compass.

.h file code:

import "UIKit/UIKit.h"
import "CoreLocation/CoreLocation.h"

@interface Compass_VIew : UIViewController<CLLocationManagerDelegate> 
    {

IBOutlet UIImageView *arrow;

 IBOutlet UIImageView *arrowC;

 CLLocationManager *locManager;

}

@property (nonatomic, retain) CLLocationManager *locManager;

@property(readonly, nonatomic) BOOL headingAvailable;

@end

.m file code

didUpdateHeading method code:

NSLog(@"New magnetic heading: %f", newHeading.magneticHeading);
NSLog(@"New true heading: %f", newHeading.trueHeading);

viewDidLoad method code:

[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[[self navigationController] setNavigationBarHidden:NO animated:NO];
locManager = [[[CLLocationManager alloc] init] autorelease];
locManager.desiredAccuracy= kCLLocationAccuracyBest;
locManager.delegate = self;
[self.locManager startUpdatingHeading];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:27:42+00:00Added an answer on June 1, 2026 at 5:27 pm

    you need to give the transform for the needle of the compass

    it should be like this

    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self.view.backgroundColor = [UIColor clearColor];
    
        locationManager = [[CLLocationManager alloc] init];
        locationManager.delegate = self; 
        locationManager.desiredAccuracy = kCLLocationAccuracyBest; 
        locationManager.distanceFilter = kCLDistanceFilterNone; 
        [locationManager startUpdatingLocation];
        [locationManager startUpdatingHeading];
    
        CLLocation *location = [locationManager location];
        CLLocationCoordinate2D user = [location coordinate];
    
    
    }
    
    -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
        CLLocationCoordinate2D here =  newLocation.coordinate;
    
    
    }
    
    - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
    
        double trueheading = newHeading.magneticHeading;
        double northangle = (trueheading*M_PI/180);
        redPin.transform = CGAffineTransformMakeRotation(northangle); 
    }
    

    Here redPin is my needle view and by the way dont forget to import CoreLocation Framework

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created one WCF service , which is working fine, now i want
I have made an application which calls the phone's contact list but i want
I have an application in which I want to display various charts, mostly bar
I have created one application in which Main Form Calls Sub Form on FormShow
I am developing an android application. Now i have created one function which create
i am working on one application in which i have created one table view
I have created one MVC3 application. In which I'm selecting two Ids from two
I have two windows application, one is a windows service which create EventWaitHandle and
I have created one application in flex that is accessing the Java webservice using
I have created one application in j2me, I have used json parsing in that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.