UIVisualEffectView *vibrantView = [[UIVisualEffectView alloc] initWithEffect:[UIVibrancyEffect effectForBlurEffect:blur]]; vibrantView.frame = blurView.bounds;
UILabel *label = [[UILabel alloc] init];
[label setFont:[UIFont fontWithName:@"HelveticaNeue" size:33]]; label.frame = CGRectMake(8, 30, 400, 500);
label.numberOfLines = 0;
label.text = @"THIS IS VIBRANT TEXT!";
// add vibrantView to first blurView
[vibrantView.contentView addSubview:label];
[blurView.contentView addSubview:vibrantView];
UIBlurEffect *blur =[UIBlurEffecteffectWithStyle:UIBlurEffectStyleDark];
UIVisualEffectView *blurView = [[UIVisualEffectView alloc] initWithEffect:blur];
blurView.frame = self.hudView.bounds;
[self.view addSubview:blurView];
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
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { | |
CGPoint translation = [scrollView.panGestureRecognizer translationInView:scrollView.superview]; | |
if(translation.y > 0) | |
{ | |
NSLog(@"dragging downwards!"); | |
} else | |
{ | |
NSLog(@"dragging up!"); | |
} |
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
// Can also be placed within scrollviews layoutSubviews | |
- (void)centerScrollViewContents { | |
CGSize boundsSize = self.scrollView.bounds.size; | |
CGRect contentsFrame = self.imageView.frame; | |
if (contentsFrame.size.width < boundsSize.width) { | |
contentsFrame.origin.x = (boundsSize.width - contentsFrame.size.width) / 2.0f; | |
} else { | |
contentsFrame.origin.x = 0.0f; |
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
- (void)scrollViewDoubleTapped:(UITapGestureRecognizer*)recognizer { | |
// 1 | |
CGPoint pointInView = [recognizer locationInView:self.imageView]; | |
// 2 | |
CGFloat newZoomScale = self.scrollView.zoomScale * 1.5f; | |
newZoomScale = MIN(newZoomScale, self.scrollView.maximumZoomScale); | |
// 3 | |
CGSize scrollViewSize = self.scrollView.bounds.size; |
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
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { | |
NSString *filteredString = [string stringByReplacingOccurrencesOfString:@"\n" withString:@""]; | |
NSInteger textLength = [textField.text length] - range.length + [filteredString length]; | |
if (textLength > 0) { | |
self.redeemButton.enabled = YES; | |
} | |
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
// Whenever a button, tap , or something 'happens' within a cell subclass, send a message up thee olde Responder Chain | |
// -- within tablecell_subclass.m | |
- (IBAction)connectButtonClicked:(id)sender { | |
SEL selConnectButton = sel_registerName("connectButtonResponder:"); | |
[[UIApplication sharedApplication] sendAction:selConnectButton to:nil from:self forEvent:nil]; | |
} | |
// within the UITableViewController , responde to the selector "connectButtonResponder" |
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
// classical merge algo | |
Array.prototype.mergesort = function() { | |
console.log(this) | |
if(this.length == 1) { | |
return this; | |
} | |
var merge = function(left, right){ | |
var sorted = []; | |
var l = r = 0; | |
while(l < left.length && r < right.length){ |
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
class AppDelegate | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
alert = UIAlertView.alloc.initWithTitle("Oh yeah!", message:"OHHAI!", delegate:nil, cancelButtonTitle:"OK", otherButtonTitles:nil) | |
alert.show | |
true | |
end | |
end |
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
// Example for Turquoise | |
// rgb(26, 188, 156) | |
[UIColor colorWithRed:26/255.0f green:188/255.0f blue:156/255.0f alpha:1.0]; |