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
UIImage *backgroundImage = [UIImage imageNamed:@"UI_navbar.png"]; | |
[[UINavigationBar appearance] setBackgroundImage:backgroundImage | |
forBarMetrics:UIBarMetricsDefault]; | |
UIImage *backButton = [[UIImage imageNamed:@"UI_backbutton.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0,0,0,0)]; | |
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButton forState:UIControlStateNormal | |
barMetrics:UIBarMetricsDefault]; | |
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButton forState:UIControlStateHighlighted | |
barMetrics:UIBarMetricsDefault]; | |
[[UINavigationBar appearance] setTitleTextAttributes: | |
[NSDictionary dictionaryWithObjectsAndKeys: |
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
UIImage *tabBackground = [[UIImage imageNamed:@"tab_bg"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)]; | |
[[UITabBar appearance] setBackgroundImage:tabBackground]; |
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
for (id img in searchBar.subviews) { | |
if ([img isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) { | |
[img removeFromSuperview]; | |
} | |
} | |
[searchBar setSearchFieldBackgroundImage:[UIImage imageNamed:@"UI_searchbar.png"] forState:UIControlStateNormal]; | |
searchView.backgroundColor = [UIColor clearColor]; | |
for (UIView *subview in [[searchBar.subviews objectAtIndex:0] subviews]) { | |
subview.alpha = 0.0; | |
subview.backgroundColor = [UIColor clearColor]; |
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
int main() { | |
for( int i=1; i<=100; i++) | |
{ | |
if(i%3==0) | |
printf("Fizz"); | |
if(i%5==0) | |
printf("Buzz"); | |
if(i%3!=0 && i%5!=0) | |
printf("%d",i); |
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
double delayInSeconds = 2.0; | |
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); | |
dispatch_after(popTime, dispatch_get_main_queue(), ^(void) { |
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
dispatch_async(dispatch_get_main_queue(), ^{ | |
previewToSave = nil; | |
CGSize screenSize = self.view.bounds.size; | |
float scaleFactor = 0.2; | |
const size_t originalWidth = screenSize.width * scaleFactor; | |
const size_t originalHeight = screenSize.height * scaleFactor; | |
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); | |
CGContextRef ctx = CGBitmapContextCreate(nil, originalWidth, originalHeight, 8, 4*(int)originalWidth, colorSpaceRef, kCGImageAlphaPremultipliedLast); | |
if (ctx != 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
dispatch_async(dispatch_get_main_queue(), ^{ | |
previewToSave = nil; | |
CGSize screenSize = self.view.bounds.size; | |
float scaleFactor = 0.2; | |
const size_t originalWidth = screenSize.width * scaleFactor; | |
const size_t originalHeight = screenSize.height * scaleFactor; | |
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); | |
CGContextRef ctx = CGBitmapContextCreate(nil, originalWidth, originalHeight, 8, 4*(int)originalWidth, colorSpaceRef, kCGImageAlphaPremultipliedLast); | |
if (ctx != 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
<plist version="1.0"> | |
<array> | |
<dict> | |
<key>category</key> <string>classic</string> | |
<key>quote</key> <string>Frankly my dear, I don't give a dam.</string> | |
<key>source</key> <string>Gone with the wind</string> | |
</dict> |
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 *path = [[NSBundle mainBundle] pathForResource:@"document" ofType:@"pdf"]; | |
NSURL *targetURL = [NSURL fileURLWithPath:path]; | |
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL]; | |
[webView loadRequest:request]; |
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
func delay(delay:Double, closure:()->()) { | |
dispatch_after( | |
dispatch_time( | |
DISPATCH_TIME_NOW, | |
Int64(delay * Double(NSEC_PER_SEC)) | |
), | |
dispatch_get_main_queue(), closure) | |
} |