Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-13-2010, 10:35 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 22
Default Using different accelerometer classes?

Hi all,

I have problems with integrating two different accelerometer classes.

In my first class I am writing data to a path/file:
Quote:
- (void)accelerometer: (UIAccelerometer *)accelerometer didAccelerate: (UIAcceleration *)accel {

NSDate *now = [NSDate date];
NSTimeInterval interval = [now timeIntervalSinceDate:startDate];


NSString *loggedData = [NSString stringWithFormat:@"%f,%f,%f,%f\r\n", interval, accel.x, accel.y, accel.z];
[self writeToFile:loggedData];

}
But now I want to integrate another function into these class to count a certain movement while writing my data...

Quote:
- (void)accelerometer2: (UIAccelerometer *)accelerometer didAccelerate: (UIAcceleration *)acceleration {

if ( fabsf(acceleration.x) > kAccelerationThreshold) {
movement++;

NSString *movementcount = [NSString stringWithFormat:@"%d", movement];

[moves setText:movementcount];
}


}
Does I have to write a new class or should it be all in one class?

Thanks in advance
yannickd60 is offline   Reply With Quote
Old 03-13-2010, 10:53 AM   #2 (permalink)
Pro. Game Developer
iPhone Dev SDK Supporter
 
Join Date: Feb 2009
Location: żLa Islas Hermosas?
Posts: 2,178
Default

Why can't you just merge the contents of both functions into a single function?
__________________
~~ Word Flurry ~~ App Store / Website / Facebook
Kalimba is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 233
16 members and 217 guests
ADY, Alsahir, cacao, dacapo, Dani77, Desert Diva, djohnson, F_Bryant, HemiMG, jansan, M@realobjects, MarkC, prchn4christ, smethorst, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,228
Posts: 380,762
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:53 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0