View Constraints.m
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
NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[redView(==blueView)]-0-[blueView]-|" | |
options:0 | |
metrics:nil | |
views:@{@"redView": redView, | |
@"blueView": blueView}]; | |
[self.view addConstraints:constraints]; |
View editing_changed.m
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
[self.textField addTarget:self action:@selector(textFieldDidChangeText:) forControlEvents:UIControlEventEditingChanged]; | |
- (IBAction)textFieldDidChangeText:(UITextField *)textField { | |
NSLog(@"Updated text: %@", textField.text); | |
} |
View DateFormatter.playground
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 Foundation | |
import UIKit | |
let date = NSDate(timeIntervalSince1970:1426003200) | |
let dateFormatter = NSDateFormatter() | |
dateFormatter.dateStyle = .MediumStyle | |
dateFormatter.stringFromDate(date) |
View DateFormatter.playground
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 Foundation | |
import UIKit | |
let date = NSDate(timeIntervalSince1970:1426003200) | |
let dateFormatter = NSDateFormatter() | |
dateFormatter.dateStyle = .MediumStyle | |
dateFormatter.stringFromDate(date) |
View ValidPhoneNumber.m
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
- (BOOL)isValidPhoneNumber:(NSString *)phoneNumberString { | |
NSError *error = nil; | |
NBPhoneNumber *phoneNumber = [self.util parse:phoneNumberString defaultRegion:self.region error:&error]; | |
if (error) { | |
return NO; | |
} else { | |
return [self.util isValidNumber:phoneNumber]; |
View Transliterate.m
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 *string = [@"Fıstıkçı Şahap" stringByFoldingWithOptions:NSDiacriticInsensitiveSearch | |
locale:[NSLocale localeWithLocaleIdentifier:@"en"]]; |
View DateFormatterExample.playground
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
// Playground - noun: a place where people can play | |
import UIKit | |
import Foundation | |
let timeInterval = NSDate().timeIntervalSince1970 | |
let date = NSDate(timeIntervalSince1970: timeInterval) | |
let dateFormatter = NSDateFormatter() |
NewerOlder