Jun 21, 2014

[iOS] DEBUG mode in code

Check your projects build settings for debug to ensure that 'DEBUG' is being set - do this by selecting the project and clicking on the build settings tab. Search for 'DEBUG' and look to see if indeed DEBUG is being set.

then conditionally code for DEBUG in your source files

#ifdef DEBUG
// Something to log your sensitive data here

Jun 19, 2014

Say Ah

Say Ah

Category: Education
Released: Jun 18, 2014
Version: 1.0.0
Size: 32.0 MB
Language: English

Link: iTunes

Jun 7, 2014

[iOS] validate Url from NSString

- (BOOL) validateUrl: (NSString *) url


     NSString *theURL =@"(http|https)://((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+";

     NSPredicate *urlTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", theURL];
    return [urlTest evaluateWithObject:url];

Jun 5, 2014

[iOS] Get the screen width and height

If you need the screen size, you should look at the object that represents the screen itself, like this:
CGRect screenRect = [[UIScreen mainScreen] bounds];CGFloat screenWidth = screenRect.size.width;CGFloat screenHeight = screenRect.size.height;
+ (CGFloat) window_height   {
    return [UIScreen mainScreen].applicationFrame.size.height;
+ (CGFloat) window_width   {
    return [UIScreen mainScreen].applicationFrame.size.width;

Jun 2, 2014

[iOS] image With Color

- (UIImage *)imageWithColor:(UIColor *)color {
    CGRect rect = CGRectMake(0, 0, 60, 60);
    UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0);    [color setFill];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();    UIGraphicsEndImageContext();  
    return image;

[iOS] Validation email from string

+ (BOOL) isEmailFormat:(NSString *)email
    NSString *emailRegEx =
    @"-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])";    NSPredicate *regExPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegEx];
    BOOL myStringMatchesRegEx = [regExPredicate evaluateWithObject:email];
    NSLog(@"check email result %i",myStringMatchesRegEx);
    return myStringMatchesRegEx;