This file contains hidden or 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
NSView *contentView = [self.window contentView]; | |
self.button = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 50.0f)]; | |
[self.button setTranslatesAutoresizingMaskIntoConstraints:NO]; | |
[self.button setTitle:@"This is a test button"]; | |
[self.button setBordered:YES]; | |
[contentView addSubview:self.button]; | |
NSButton *button = self.button; |
This file contains hidden or 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 <Foundation/Foundation.h> | |
@interface NSObject (FancyDescription) | |
// | |
// Output the values of all the properties associated with a given class. | |
// Iterates all the way down the chain until we hit NSObject. | |
// | |
- (NSString *)sg_description; |
This file contains hidden or 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
- (NSString *)description | |
{ | |
return [NSString stringWithFormat:@"First = %@, Last = %@", self.firstName, self.lastName]; | |
} |
This file contains hidden or 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
// Store a password | |
NSError *storePasswordError = nil; | |
BOOL passwordSuccessfullyCreated = [SGKeychain setPassword:@"testpassword" username:@"justin" serviceName:@"Twitter" updateExisting:NO error:&storePasswordError]; | |
if (passwordSuccessfullyCreated == YES) | |
{ | |
NSLog(@"Password successfully created"); | |
} | |
else | |
{ |
This file contains hidden or 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
Bigham:Debug-iphoneos justin$ codesign -d --entitlements :/dev/stdout ./SGBlahExample.app | |
Executable=/Users/justin/Library/Developer/Xcode/DerivedData/SGBlahExample-eaniwkzkgbtjdidpkonkaycajvbh/Build/Products/Debug-iphoneos/SGBlahExample/SGBlahExample | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>application-identifier</key> | |
<string>PK266D9YNJ.secondgear.SGBlahExample</string> | |
<key>get-task-allow</key> |
This file contains hidden or 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
for (UIView *view in self.webView.subviews) | |
{ | |
if ([view isKindOfClass:[UIScrollView class]] == YES) | |
{ | |
for (UIView *innerSubview in [view subviews]) | |
{ | |
if ([innerSubview isKindOfClass:[UIImageView class]]) | |
{ | |
innerSubview.hidden = YES; | |
} |
This file contains hidden or 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
- (id)init | |
{ | |
if ((self = [super initWithNibName:nil bundle:nil])) | |
{ | |
[self setup]; | |
} | |
return self; | |
} | |
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil |
This file contains hidden or 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
- (id)initWithDocument:(ELDocument *)document | |
{ | |
if ((self = [super initWithNibName:nil bundle:nil])) | |
{ | |
// Do your stuff in here. | |
} | |
} | |
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil | |
{ |
This file contains hidden or 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
- (id)initWithUserName:(NSString *)userName key:(NSString *)apiKey delegate:(id <SGMimiMailerDelegate>)delegate | |
{ | |
if ((self = [super init])) | |
{ | |
_userName = SG_RETAIN(userName); | |
_apiKey = SG_RETAIN(apiKey); | |
_delegate = delegate; | |
} | |
return self; |
This file contains hidden or 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
#ifndef SG_WEAK | |
#if defined __IPHONE_OS_VERSION_MIN_REQUIRED | |
#if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_4_3 | |
#define __SG_WEAK __weak | |
#define SG_WEAK weak | |
#else | |
#define __SG_WEAK __unsafe_unretained | |
#define SG_WEAK unsafe_unretained | |
#endif | |
#elif defined __MAC_OS_X_VERSION_MIN_REQUIRED |