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
// this code will help you to zoom out to world-view | |
// step.1 create co-ordianate-span as follows | |
MKCoordinateSpan span = {.latitudeDelta = 180, .longitudeDelta = 360}; | |
// step.2 crate region as follows | |
MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake(0.0000f, 0.0000f), span); | |
// step.3 zoom using region to map as follows | |
[self.mapView setRegion:region animated:YES]; |
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
// get image color & size as parameters | |
+ (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size | |
{ | |
UIImage *img = nil; | |
// create rectangle/square of size supplied | |
CGRect rect = CGRectMake(0, 0, size.width, size.height); | |
// create context of size supplied | |
UIGraphicsBeginImageContext(rect.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
#define NSLog(args...) CustomLog(__FILE__, __LINE__, __PRETTY_FUNCTION__, args) | |
static inline void CustomLog(const char *file, int lineNumber, const char *functionName, NSString *format, ...) | |
{ | |
// Type to hold information about variable arguments. | |
va_list ap; | |
// Initialize a variable argument list. | |
va_start (ap, format); | |
// NSLog only adds a newline to the end of the NSLog format if | |
// one is not already there. | |
// Here we are utilizing this feature of NSLog() |
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
--comment | |
--step-1 - show icons | |
defaults write com.apple.finder CreateDesktop -bool true | |
--step-2 - kill finder & relaunch | |
killall Finder |
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
--comment | |
--step-1 - hide icons | |
defaults write com.apple.finder CreateDesktop -bool false | |
--step-2 - kill finder & relaunch | |
killall Finder |
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
// a function to take screen-shot of application's screen | |
- (UIImage*)takeScreenshot | |
{ | |
// get the key-window references | |
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow]; | |
// manipulate boundries of key-window | |
CGRect rect = [keyWindow bounds]; | |
// create context using 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
#!/bin/bash | |
createImagesets() { | |
for d in *; do | |
if [ -d $d ] ; then | |
(cd $d; createImagesets) | |
fi | |
if [ -f $d ] ; then | |
a=${d%@2x.*}; | |
dirname=$a".imageset"; |
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
#define DEBUG_MODE | |
#ifdef DEBUG_MODE | |
#define STLog(x,...) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(x), ##__VA_ARGS__]) | |
#else | |
#define STLog | |
#endif |
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 ALERT_WITH_TAG(NSUInteger tag,NSString *title, NSString *message,NSString *canceBtnTitle,id delegate,NSString *otherButtonTitles, ... ) | |
{ | |
UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:title | |
message:message | |
delegate:delegate | |
cancelButtonTitle:canceBtnTitle | |
otherButtonTitles:nil | |
]; | |
va_list args; |
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
// pass color & supply masked (masked with black-color) image | |
+ (UIImage *)applyColor:(UIColor *)color toImage:(UIImage*)toImage{ | |
// create context | |
UIGraphicsBeginImageContextWithOptions(toImage.size, NO, toImage.scale); | |
// get context reference | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
// Change the origin of the user coordinate system in a context. | |
CGContextTranslateCTM(context, 0, toImage.size.height); |