Last active
December 26, 2015 14:09
-
-
Save esafwan/7163726 to your computer and use it in GitHub Desktop.
Getting Value from test field in objective C and setting it to another textfield.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Cocoa/Cocoa.h> | |
@interface AppDelegate : NSObject <NSApplicationDelegate> | |
//The UI have a pushbutton, textfield1 & textfield2. | |
//create an action for push button with below code. (ctrl + drag to AppDelegate.h) | |
- (IBAction)button:(id)sender; | |
//create an outlet for each text fields textfield. (ctrl + drag to AppDelegare.h) | |
@property (weak) IBOutlet NSTextField *textField1; | |
@property (weak) IBOutlet NSTextField *textField2; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "AppDelegate.h" | |
@implementation AppDelegate | |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
// Insert code here to initialize your application | |
} | |
//And then in AppDelegate.m file | |
//Below code takes value from textField2 and puts in textField1. | |
- (IBAction)button:(id)sender { | |
[self.textField1 setFloatValue:[self.textField2 intValue]]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment