//
// AppDelegate.h
//
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate,NSTextViewDelegate>
{
NSTextView *_textView;
NSButton *_button;
NSTextField *_textField;
NSTableView * _tableview;
}
@property IBOutlet NSTextView *textView;
@property IBOutlet NSButton *button;
@property IBOutlet NSTextField *textField;
@property IBOutlet NSTableView *tableView;
@property (assign) IBOutlet NSWindow *window;
- (IBAction)dosome:(id)sender;
@end
//
// AppDelegate.m
#import "AppDelegate.h"
@implementation AppDelegate
@synthesize button = _button;
@synthesize textField = _textField;
@synthesize textView = _textView;
@synthesize tableView = _tableview;
- (IBAction)dosome:(id)sender
{
NSLog(@" you click btn");
[self.button setHidden:YES];//隐藏按钮
NSSize size = {200,100};
[[self.textView enclosingScrollView] setFrameSize:size];//调整textview宽、高
[[self.tableView enclosingScrollView] setFrameSize:size];//调整tableview宽、高
}
- (void) awakeFromNib
{
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
}
@end
注:记得在XLB文件中为每.h中的第一个IBOutlet建议连接,否则修改时不会产生变化。切记