我想轉換度數據加速度。 但我不知道代碼(目標c)非常好。有人幫我意識到這一點? 我需要看看度數而不是加速度計數據! 我這樣:度數轉換數據加速度計
#import "APLGraphViewController.h"
#import "APLGraphView.h"
#import "APLAppDelegate.h"
#import "math.h"
@interface APLGraphViewController()
@property (weak, nonatomic) IBOutlet UILabel *xLabel;
@property (weak, nonatomic) IBOutlet UILabel *yLabel;
@property (weak, nonatomic) IBOutlet UILabel *zLabel;
@property (weak, nonatomic) IBOutlet UISlider *updateIntervalSlider;
@end
@implementation APLGraphViewController
#pragma mark - View lifecycle
-(void)viewDidLoad
{
[super viewDidLoad];
self.updateIntervalSlider.value = 0.0f;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self startUpdatesWithSliderValue:(int)(self.updateIntervalSlider.value * 100)];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[self stopUpdates];
}
#pragma mark - Responding to events
- (IBAction)takeSliderValueFrom:(UISlider *)sender
{
[self startUpdatesWithSliderValue:(int)(sender.value * 100)];
}
- (void)setLabelValueX:(double)x y:(double)y z:(double)z
{
self.xLabel.text = [NSString stringWithFormat:@"x: %f", x];
self.yLabel.text = [NSString stringWithFormat:@"y: %f", y];
self.zLabel.text = [NSString stringWithFormat:@"z: %f", z];
}
- (void)setLabelValueRoll:(double)roll pitch:(double)pitch yaw:(double)yaw
{
self.xLabel.text = [NSString stringWithFormat:@"roll: %f", roll];
self.yLabel.text = [NSString stringWithFormat:@"pitch: %f", pitch];
self.zLabel.text = [NSString stringWithFormat:@"yaw: %f", yaw];
}
#pragma mark - Update methods stub implementations
- (void)startUpdatesWithSliderValue:(int)sliderValue
{
return;
}
- (void)stopUpdates
{
return;
}
@end
我怎樣才能獲得學位?
謝謝
似乎與XCode沒有關係。看起來更像是一個數學問題,而不是Objective-C的知識。 – Larme
可以,我會使用函數「atan2(),」不,但我可以正確實施它,你知道,請幫我嗎? – user3119558