-
Notifications
You must be signed in to change notification settings - Fork 240
/
main.m
31 lines (26 loc) · 921 Bytes
/
main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// main.m
// iOS Artwork Extractor
//
// Created by Cédric Luthi on 19.02.10.
// Copyright Cédric Luthi 2010. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <objc/runtime.h>
CGFloat iOS3_scale(id self, SEL _cmd)
{
return 1.0;
}
int main(int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// -[UIView alpha] has the same method signature as -[UIScreen/UIImage scale]
Method alpha = class_getInstanceMethod([UIView class], @selector(alpha));
if (![UIScreen instancesRespondToSelector:@selector(scale)])
class_addMethod([UIScreen class], @selector(scale), (IMP)iOS3_scale, method_getTypeEncoding(alpha));
if (![UIImage instancesRespondToSelector:@selector(scale)])
class_addMethod([UIImage class], @selector(scale), (IMP)iOS3_scale, method_getTypeEncoding(alpha));
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}