Wednesday, October 16, 2013

SVN missing in Mac OS X 10.8

After upgrading to Mountain Lion am unable to launch my SVNX tool (used to access SVN source control). Then I figured out Subverion library are not coming with by default with OS upgrade. Fix is given below:
Credit: http://blog.grapii.com/2012/08/svn-missing-in-mac-os-x-10-8-mountain-lion/

Old iOS SDKs in Xcode 5

How to build your app with sdk6.1 in Xcode 5. Because when you want to debug the iOS7 device with XCode 4 is not possible.

Credit: http://blog.spacemanlabs.com/2013/09/how-to-support-old-ios-sdks-in-xcode-5

Wednesday, April 10, 2013

Nexus 4 - config email signature

Credit:

http://www.dummies.com/how-to/content/how-to-create-an-email-signature-on-your-nexus-7.html

Monday, February 4, 2013

Get iOS Device Platform



#include
#include


/*
 Platforms
 iPhone1,1 -> iPhone 2G
 iPhone1,2 -> iPhone 3G
 iPhone2,1 -> iPhone 3GS
 iPhone3,1 -> iPhone 4 GSM
 iPhone3,3 -> iPhone 4 CDMA
 iPhone4,1 -> iPhone 4S
 iPod1,1   -> iPod touch 1G
 iPod2,1   -> iPod touch 2G
 iPod3,1   -> iPod touch 3G
 iPad1,1   -> iPad (Wifi or GSM)
 iPad2,1   -> iPad 2 Wifi
 iPad2,2   -> iPad 2 GSM
 iPad2,3   -> iPad 2 CDMA
 */
+ (NSString *) devicePlatform
{
    size_t size;
    sysctlbyname("hw.machine", NULL, &size, NULL, 0);
    char *machine = (char *)malloc(size);
    sysctlbyname("hw.machine", machine, &size, NULL, 0);
    NSString *platform = [NSString stringWithCString: machine encoding: NSUTF8StringEncoding]; 
    free(machine);
    return platform;
}

iOS6.1 - Tested.

Friday, February 1, 2013

Unit Test Case Configuration in Xcode 4

https://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/UnitTesting/00-About_Unit_Testing/about.html

Saturday, January 5, 2013

UILabel's adjustsFontSizeToFitWidth and minimumFontSize play nice with multi-lined

Credit:

https://gist.github.com/2766074

// Original code from http://stackoverflow.com/a/4383281/463892

Code:

- (CGFloat)fontSizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size minimumFontSize:(CGFloat)minimumFontSize {
   
    CGFloat fontSize = [font pointSize];
   
    CGFloat height = [self sizeWithFont:font constrainedToSize:CGSizeMake(size.width,FLT_MAX) lineBreakMode:UILineBreakModeWordWrap].height;
   
    UIFont *newFont = font;
   
    //Reduce font size while too large, break if no height (empty string)
   
    while (height > size.height && height != 0 && fontSize > minimumFontSize) {
       
        fontSize--;
       
        newFont = [UIFont fontWithName:font.fontName size:fontSize];
       
        height = [self sizeWithFont:newFont constrainedToSize:CGSizeMake(size.width,FLT_MAX) lineBreakMode:UILineBreakModeWordWrap].height;
       
    };
   
    // Loop through words in string and resize to fit
   
    for (NSString *word in [self componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]) {
       
        CGFloat width = [word sizeWithFont:newFont].width;
       
        while (width > size.width && width != 0 && fontSize > minimumFontSize) {
           
            fontSize--;
           
            newFont = [UIFont fontWithName:font.fontName size:fontSize];
           
            width = [word sizeWithFont:newFont].width;
           
        }
       
    }
   
    return fontSize;
   
}