|
|
@ -1,32 +1,40 @@
|
|
|
|
#import "MainViewController.h"
|
|
|
|
#import "MainViewController.h"
|
|
|
|
#import <objc/runtime.h>
|
|
|
|
|
|
|
|
#import "MainView.h"
|
|
|
|
#import "MainView.h"
|
|
|
|
|
|
|
|
|
|
|
|
@implementation MainViewController {
|
|
|
|
@interface MainViewController ()
|
|
|
|
NSButton *firstButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
@property (nonatomic, strong) NSButton *selectDirectoryButton;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@implementation MainViewController
|
|
|
|
|
|
|
|
|
|
|
|
- (void) loadView {
|
|
|
|
- (void) loadView {
|
|
|
|
NSLog(@"[MainViewController] loadView");
|
|
|
|
NSLog(@"[MainViewController] loadView");
|
|
|
|
self.view = [[MainView alloc] initWithFrame:NSMakeRect(0, 0, 640, 480)];
|
|
|
|
self.view = [[MainView alloc] init];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void) viewDidLoad {
|
|
|
|
- (void) viewDidLoad {
|
|
|
|
NSLog(@"[MainViewController] viewDidLoad");
|
|
|
|
NSLog(@"[MainViewController] viewDidLoad");
|
|
|
|
[super viewDidLoad];
|
|
|
|
[super viewDidLoad];
|
|
|
|
|
|
|
|
|
|
|
|
firstButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 120, 20)];
|
|
|
|
[self.view.widthAnchor constraintGreaterThanOrEqualToConstant:640.0].active = YES;
|
|
|
|
[firstButton setButtonType:NSToggleButton];
|
|
|
|
[self.view.heightAnchor constraintGreaterThanOrEqualToConstant:480.0].active = YES;
|
|
|
|
[firstButton setTitle:@"fart"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i=0;
|
|
|
|
self.selectDirectoryButton = [NSButton buttonWithTitle:@"select directory"
|
|
|
|
unsigned int mc = 0;
|
|
|
|
target:self
|
|
|
|
Method * mlist = class_copyMethodList(object_getClass(firstButton), &mc);
|
|
|
|
action:@selector(fart:)];
|
|
|
|
NSLog(@"%d methods", mc);
|
|
|
|
[self.selectDirectoryButton setTranslatesAutoresizingMaskIntoConstraints:NO];
|
|
|
|
for(i=0;i<mc;i++)
|
|
|
|
|
|
|
|
NSLog(@"Method no #%d: %s", i, sel_getName(method_getName(mlist[i])));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[self.view addSubview:firstButton];
|
|
|
|
|
|
|
|
|
|
|
|
[self.view addSubview:self.selectDirectoryButton];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[self.selectDirectoryButton.rightAnchor
|
|
|
|
|
|
|
|
constraintEqualToAnchor:self.view.rightAnchor
|
|
|
|
|
|
|
|
constant:-8.0].active = YES;
|
|
|
|
|
|
|
|
[self.selectDirectoryButton.topAnchor
|
|
|
|
|
|
|
|
constraintEqualToAnchor:self.view.topAnchor
|
|
|
|
|
|
|
|
constant:8.0].active = YES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void) viewWillAppear {
|
|
|
|
- (void) viewWillAppear {
|
|
|
@ -58,4 +66,9 @@
|
|
|
|
NSLog(@"[MainViewController] viewDidLayout");
|
|
|
|
NSLog(@"[MainViewController] viewDidLayout");
|
|
|
|
return [super viewDidLayout];
|
|
|
|
return [super viewDidLayout];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void) fart {
|
|
|
|
|
|
|
|
NSLog(@"[MainViewController] fart!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
@end
|
|
|
|