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
NSString *date = nil; | |
NSScanner *scanner = [NSScanner scannerWithString:@"/Date(1312603200000-0400)/"]; | |
while ([scanner isAtEnd] == NO) { | |
[scanner scanUpToString:@"(" intoString:NULL]; | |
[scanner setScanLocation:[scanner scanLocation] + 1]; | |
[scanner scanUpToString:@")" intoString:&date]; | |
break; | |
} |
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
// Get number of rows in your table. | |
NSUInteger existingRows = ...; | |
// Create the index path of new cell to be added. | |
NSIndexPath *newCellIndexPath = [NSIndexPath indexPathForRow:existingRows inSection:0]; | |
// Update the datasource model... | |
// Add the new cell to table. | |
[self.myTableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newCellIndexPath] withRowAnimation:UITableViewRowAnimationFade]; |
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
- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { | |
[self.view removeFromSuperview]; | |
} | |
-(void) dismiss { | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationDuration:0.3f]; | |
[UIView setAnimationDelegate:self]; | |
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; | |
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
<html> | |
<head> | |
<title>Recipe</title> | |
<link href='style.css' rel='stylesheet' type='text/css' /> | |
</head> | |
<body> | |
<div style='width: 320px;' align='center'> | |
<div class='stats' > | |
<div class='recipe_title' align='center'> | |
<span class='title_brace'>{</span><span>Title</span><span class='title_brace'>}</span> |
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
NSMutableArray *parentArray = [[NSMutableArray alloc] initWithCapacity:5]; | |
for (int i = 0; i < 5; i++) { | |
[parentArray addObject:[NSNumber numberWithInt:i]]; | |
} | |
NSMutableArray *childArray = [[NSMutableArray alloc] initWithObjects:[NSNumber numberWithInt:0], [NSNumber numberWithInt:1], nil]; | |
[parentArray removeObjectsInArray:childArray]; | |
NSLog(@"%@", parentArray); | |
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
#define USERNAME_KEY @"username" | |
#define PASSWORD_KEY @"password" | |
-(void) saveUser:(NSString *) username andPassword:(NSString *) password { | |
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; | |
// Save the username. | |
[userDefaults setObject:username forKey:USERNAME_KEY]; | |
[userDefaults synchronize]; | |
// Save the password. |
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
@try { | |
if (versionOk == YES) | |
{ | |
NSLog(@"Before Saving - Username: %@ and Password: %@", username.text, password.text); | |
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; | |
[userDefaults setObject:username.text forKey:@"username"]; |
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
if (indexPath.row == 4) { | |
NSString *username = [[NSUserDefaults standardUserDefaults] objectForKey:@"username"]; | |
NSString *password = [[NSUserDefaults standardUserDefaults] objectForKey:@"password"]; | |
if (username && password) { | |
// User already exists. Go Directly to ever note view controller. | |
}else { | |
// User has not logged in. Go to ever note login view controller. | |
Evernotelogin *evernoteView = [[Evernotelogin alloc] initWithNibName:@"Evernotelogin" |
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
@interface Dog : NSObject { | |
} | |
@property (nonatomic, assign) id<DogDelegate> delegate; | |
-(void) bark; | |
@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 "Dog.h" | |
@implementation Dog | |
@synthesize delegate; | |
-(void) bark { | |
if(self.delegate != nil && [self.delegate respondsToSelector:@selector(dogWillStartBarking:)]) { | |
[self.delegate dogWillStartBarking:self]; | |
} |
OlderNewer