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 NSNumber (Enumeration) | |
- (void)times:(void (^)(NSUInteger index, BOOL *stop))block; | |
@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
@interface UILabelStrikethrough : UILabel { | |
int xOffset; | |
int yOffset; | |
int widthOffset; | |
int stroke; | |
UIColor* strokeColor; | |
} | |
@property (nonatomic) int xOffset; | |
@property (nonatomic) int yOffset; | |
@property (nonatomic) int widthOffset; |
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 ViewController | |
@synthesize player = _player; | |
-(IBAction)playSound | |
{ | |
if (![_player isPlaying]) { | |
[_player play]; | |
} | |
} |
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)drawRect:(CGRect)rect | |
{ | |
// Drawing code | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGRect rectForBezierPath = CGRectMake(100.0, 100.0, 100.0, 100.0); | |
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rectForBezierPath byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(8.0, 8.0)]; | |
[[UIColor whiteColor] setFill]; | |
[path fill]; |
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)setupPlayer | |
{ | |
// adds the player to the view, player is an instance of MPMoviePlayerController | |
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://qthttp.apple.com.edgesuite.net/11ajdjnvkjnd10weoihf23ohfoihqw/sl_mvp.m3u8"]]; | |
// loads the movie with the above URL | |
player.view.frame = self.bounds; | |
player.view.userInteractionEnabled = YES; | |
[self addSubview:self.player.view]; | |
[self.player prepareToPlay]; |
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) drawTextInRect:(CGRect)inFrame | |
{ | |
CGRect draw = [self textRectForBounds:inFrame limitedToNumberOfLines:[self numberOfLines]]; | |
draw.origin = CGPointZero; | |
[super drawTextInRect:draw]; | |
} |
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
Three finger gestures are awesome in Xcode, but they disappeared in Lion :( | |
You can bring them back to life however... | |
Inspired by a post from @gordonhughes (http://geeksinkilts.com/?p=67), explaining how to bring them back on an external trackpad, I started digging around for a way to get it working on the internal trackpads for the mbp/mba models. | |
*edit* | |
Perhaps an easier way of doing this found by @gordonhughes again is just this 1 line in Terminal, haven't confirmed this yet though | |
defaults -currentHost write -g "com.apple.trackpad.threeFingerVertSwipeGesture" -int 1 |