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
// this is implemented, but not declared. we add the category to fix the warning | |
// (since super cannot be casted any longer in clang) | |
@interface UINavigationController(AMInternal) | |
- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item; | |
@end | |
@implementation AMNavigationController | |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
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
UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 9999)]; | |
myLabel.lineBreakMode = UILineBreakModeWordWrap; | |
myLabel.numberOfLines = 0; | |
myLabel.text = @"Some \n dynamic \n multiline \n text"; | |
[myLabel sizeToFit]; // This shrinks the 9999 down to the size of the text | |
NSLog(@"Actual height is: %f", myLabel.frame.size.height); // Use this for spacing any further elements | |
[self.view addSubview:title]; // Or add it to a scroll view, or whatever... | |
[myLabel release]; |
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
@implementation NSNotification (KeyboardHeight) | |
- (CGFloat)keyboardHeight { | |
CGRect bounds; | |
NSValue *boundsValue = [self.userInfo objectForKey:UIKeyboardBoundsUserInfoKey]; | |
if (boundsValue) { | |
[boundsValue getValue:&bounds]; | |
return bounds.size.height; | |
} else { | |
return 0; |
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/Foundation.h> | |
@interface NSURL (Pieces) | |
-(NSDictionary *)piecesDictionary; | |
@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
+ (NSDate *)dateFromISO8601String:(NSString *)iso8601 { | |
if (!iso8601) { | |
return nil; | |
} | |
const char *str = [iso8601 cStringUsingEncoding:NSUTF8StringEncoding]; | |
char newStr[24]; | |
struct tm tm; | |
size_t len = strlen(str); |
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
#!/bin/bash | |
tail -f $(ls -t "$HOME/Library/Logs/CoreSimulator/"*/system.log | head -1) |
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
-Wall | |
-Wno-deprecated-declarations | |
-Werror=incompatible-pointer-types | |
-Werror=arc-retain-cycles | |
-Werror=implicit-function-declaration | |
-Werror=return-type | |
-Werror=format | |
-Werror=mismatched-parameter-types | |
-Werror=tautological-constant-out-of-range-compare |
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)setSelected:(BOOL)selected animated:(BOOL)animated { | |
selected_ = selected; | |
if (animated) { | |
CATransition *transition = [CATransition animation]; | |
transition.duration = 0.25f; | |
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
transition.type = kCATransitionFade; | |
[self.selectionImageView.layer addAnimation:transition forKey:nil]; | |
} |
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
// | |
// DynamicTypeLabel.swift | |
// | |
// Created by Indragie on 10/16/14. | |
// Copyright (c) 2014 Indragie Karunaratne. All rights reserved. | |
// | |
import UIKit | |
class DynamicTypeLabel : UILabel { |
OlderNewer