Skip to content

Instantly share code, notes, and snippets.

@nevyn
Created August 5, 2011 20:46
Show Gist options
  • Save nevyn/1128482 to your computer and use it in GitHub Desktop.
Save nevyn/1128482 to your computer and use it in GitHub Desktop.
performSelector with number and PODs
//
// hej2AppDelegate.m
// hej2
//
// Created by Joachim Bengtsson on 2011-08-05.
// Copyright 2011 Third Cog Software. All rights reserved.
//
#import "hej2AppDelegate.h"
@implementation hej2AppDelegate
@synthesize window = _window;
-(void)otherShit:(float)totallyNotElite;
{
NSLog(@"Let's clobber the fp stack %f", totallyNotElite);
//2011-08-05 22:50:33.042 hej2[18444:707] Let's clobber the fp stack 14.000000
}
-(void)takingInt:(int)aNum
{
NSLog(@"Here's the number: %d", aNum);
// 2011-08-05 22:45:31.090 hej2[18386:707] Here's the number: 10883
}
-(void)takingFloat:(float)aNum
{
NSLog(@"Here's the number: %f", aNum);
// 2011-08-05 22:45:31.091 hej2[18386:707] Here's the number: 1337.000000
// if after otherShit:
// 2011-08-05 22:50:33.043 hej2[18444:707] Here's the number: 0.000000
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[self performSelector:@selector(takingInt:) withObject:[NSNumber numberWithInt:42]];
NSNumber *elite = [NSNumber numberWithFloat:1337];
[self otherShit:14];
[self performSelector:@selector(takingFloat:) withObject:elite];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment