Wrap text
Report abuse
#import "SampleApp.h"
@implementation SampleApp
#include
#include
#include
#include
double objc_msgSend_fpret(id self, SEL op, ...)
{
Method method = class_getInstanceMethod(self->isa, op);
int numArgs = method_getNumberOfArguments(method);
if(numArgs == 2) {
double (*imp)(id, SEL);
imp = (double (*)(id, SEL))method->method_imp;
return imp(self, op);
} else if(numArgs == 3) {
va_list ap;
va_start(ap, op);
double (*imp)(id, SEL, void *);
imp = (double (*)(id, SEL, void *))method->method_imp;
return imp(self, op, va_arg(ap, void *));
}
fprintf(stderr,
"ERROR: objc_msgSend_fpret called on <%s %p> with selector %s had to return 0.0\n", object_getClassName(self),
self, sel_getName(op));
return 0.0;
}
- (void) handleSlider: (id) whatever
{
[textView setText:[NSString
stringWithFormat:@"End Value: %f", [slider value]]];
}
- (void) applicationDidFinishLaunching: (id) unused
{
UIWindow *window;
struct CGRect rect = [UIHardware fullScreenApplicationContentRect];
rect.origin.x = rect.origin.y = 0.0f;
window = [[UIWindow alloc] initWithContentRect: rect];
mainView = [[UIView alloc] initWithFrame: rect];
textView = [[UITextView alloc]
initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)];
[textView setEditable:YES];
[textView setTextSize:14];
slider = [[UISliderControl alloc]
initWithFrame: CGRectMake(0.0f, 32.0f, 320.0f, 20.0f)];
[window orderFront: self];
[window makeKey: self];
[window _setHidden: NO];
[window setContentView: mainView];
[mainView addSubview:textView];
[mainView addSubview:slider];
[slider setMaxValue:100.0f];
[slider setMinValue:0.0f];
[slider setShowValue:YES];
// 1 == Mouse Down
// 7 == Mouse Dragged
[slider addTarget:self action:@selector(handleSlider:) forEvents:7];
[textView setText:@"Slider Sample"];
}
@end