1. "Aligning UIToolbar items"

    Wed 29 July 2009

    //Add two UIBarButtonSystemItemFlexibleSpace items to your toolbar, to the left and right of your items

     

    UIBarButtonItem *flexibleSpaceLeft = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];

    UIBarButtonItem *flexibleSpaceRight = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];

    [toolbar setItems:[NSArray arrayWithObjects:flexibleSpaceLeft, settingsButton,deleteButton,aboutButton, flexibleSpaceRight, nil]];

    [flexibleSpaceLeft release];

    [flexibleSpaceRight release];

     

    //Adding ...

    read more
  2. "New project"

    Thu 23 July 2009

    As you can see I was not posting much code lately. I was working on my scientific project http://brumboom.com/.

    I worked on AI engine to divide users on groups using their answers if they like image or not. Based on prev image -- new image is showing.

    It is ...

    read more
  3. "Get screen/application/status bar frame dimensions"

    Tue 19 May 2009

    CGRect rect;

    // Get screen dimensions

    rect = [[UIScreen mainScreen] bounds];

    NSLog(@"Bounds: %1.0f, %1.0f, %1.0f, %1.0f", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);

    // Get application frame dimensions (basically screen - status bar)

    rect = [[UIScreen mainScreen] applicationFrame];

    NSLog(@"App Frame: %1.0f, %1.0f ...

    read more
  4. "NSDictionary - read/write"

    Tue 19 May 2009

     

    // you should add empty file "hiscores" in your xCode project

     - (void)save{

    NSLog(@"saving...");

      NSDictionary *hiscores;

     

    //adding object and keys;

    //...

    //...

     

    NSString *writableFilePath = [self createEditableCopyOfFileIfNeeded:[NSString stringWithString:@"hiscores"]];

    if (![hiscores writeToFile:writableFilePath atomically:YES]){

    NSLog(@"WRITE ERROR");

     }

     

    - (void)load{

    NSLog(@"loading...");

    NSString *writableFilePath = [self createEditableCopyOfFileIfNeeded:[NSString stringWithString:@"hiscores"]];

    hiscores = [NSDictionary arrayWithContentsOfFile ...

    read more
  5. "Check if email is valid"

    Tue 19 May 2009

    #import "GTMRegex.h"

     

    //Check if email is valid

    //You need to include attached files into your project 

    //We are using regular expressions in this method

    -(BOOL)isEmailValid:(NSString *)email {

    BOOL isValid = YES;

    NSString *emailRegEx = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";

    GTMRegex *regex = [GTMRegex regexWithPattern:emailRegEx];

    if(([regex matchesString:email]) == YES ...

    read more
  6. "Randomize"

    Tue 19 May 2009

    -(int)randomInRange:(NSRange)range except:(NSArray*)exceptionArray{

    int r ;

    BOOL isSame = TRUE;

    while (isSame) {

    isSame = FALSE;

    r = rand() % range.length + range.location;

    for (NSNumber *number in exceptionArray) {

    if([number intValue] == r){

    isSame = TRUE;

    break;

    }

    }

    }

    return r;

    }

     
    //
     

    [self randomInRange:NSMakeRange(1, 10) except:[NSArray arrayWithObjects:[NSNumber numberWithInt:2],[NSNumber numberWithInt:1 ...

    read more

« Page 7 / 13 »