Skip to content

Instantly share code, notes, and snippets.

@ChrisRisner
Created November 25, 2012 23:48
Show Gist options
  • Save ChrisRisner/4145909 to your computer and use it in GitHub Desktop.
Save ChrisRisner/4145909 to your computer and use it in GitHub Desktop.
ios day 17
#import <Foundation/Foundation.h>
@interface CustomObject : NSObject
@property (strong, nonatomic) NSString *name;
@property (strong, nonatomic) NSNumber *number;
@end
@implementation CustomObject
-(NSString *)description {
return [NSString stringWithFormat:@"\nName: %@ \nNumber: %@", self.name, self.number];
}
@end
- (IBAction)tappedButtonFour:(id)sender {
CustomObject *customObject = [[CustomObject alloc] init];
customObject.name = @"my object name";
customObject.number = [NSNumber numberWithInt:42];
NSLog(@"CustomObject: %@", customObject);
}
- (IBAction)tappedButtonOne:(id)sender {
NSLog(@"Hello debug console!");
}
- (IBAction)tappedButtonOne:(id)sender {
NSLog(@"Hello debug console!");
NSLog(@"Sender: %@", sender);
}
- (IBAction)tappedButtonThree:(id)sender {
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
[dictionary setObject:@"value1" forKey:@"1"];
[dictionary setObject:@"value2" forKey:@"2"];
[dictionary setObject:@"value3" forKey:@"3"];
NSLog(@"Dictionary: %@", dictionary);
}
- (IBAction)tappedButtonThree:(id)sender {
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
[dictionary setObject:@"value1" forKey:@"1"];
[dictionary setObject:@"value2" forKey:@"2"];
[dictionary setObject:@"value3" forKey:@"3"];
NSLog(@"Dictionary: %@", dictionary);
NSArray * array = [NSArray arrayWithObjects:@"item1",@"item2",@"item3",nil];
NSLog(@"Array: %@", array);
}
- (IBAction)tappedButtonTwo:(id)sender {
UIButton *button = sender;
NSLog(@"Sender as button: %@", button);
NSLog(@"Button text: %@", button.titleLabel.text);
}
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
- (IBAction)tappedButtonOne:(id)sender;
- (IBAction)tappedButtonTwo:(id)sender;
- (IBAction)tappedButtonThree:(id)sender;
- (IBAction)tappedButtonFour:(id)sender;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment