Thursday, May 2, 2013

NSKeyedArchiver encodeFloat example ios


encodeFloat :forKey:

Encodes a given float value and associates it with a given key.
- (void)encodeFloat:(float)realv forKey:(NSString *)key
Parameters of [NSKeyedArchiver encodeFloat]
realv
The value to encode.
key
The key with which to associate realv. This value must not be nil.
  • Example of [NSKeyedArchiver encodeFloat]
  • - (void)encodeWithCoder:(NSCoder *)coder{
        [super encodeWithCoder:coder];
        [coder encodeFloat:additionalParameter1 forKey:@"float"];
    }
  • Example of [NSKeyedArchiver encodeFloat]
  •         [aCoder encodeFloat:pathDistance forKey:@"pathDistance"];
            [aCoder encodeFloat:linearDistance forKey:@"linearDistance"];
            [aCoder encodeFloat:altitudeChange forKey:@"altitudeChange"];
            [aCoder encodeFloat:averageSpeedWithFilter forKey:@"avWithFilter"];
            [aCoder encodeFloat:averageSpeedWithoutFilter forKey:@"avWithoutFilter"];