Friday, August 15, 2014

xcode shortcut for finding

Cmd + Shift + o opens the "Open quickly" dialog, where you can quickly find and open files that contain the text you enter.

Thursday, August 7, 2014

Iphone: Removing phone numbers formatting

 NSString *newString = 
[[(NSString *)(phoneNumber) componentsSeparatedByCharactersInSet:                                                    [[NSCharacterSet decimalDigitCharacterSet] invertedSet]]                                                   componentsJoinedByString:@""];

Friday, August 1, 2014

iphone: core data(database) storage

In constant.m
NSString *const kEntityNameUser = @"User";
In constant.h
extern NSString *const kEntityNameUser;


In manager file



- (void)createNewUser :(NSString *)username
                      :(NSString *)password
                      
{
    
    User *newUser = [NSEntityDescription insertNewObjectForEntityForName:kEntityNameUser inManagedObjectContext:self.context];
  
       newUser.username=username;
    newUser.password=password;
    
    [self save];

}



-(void)save {
    NSError *error;
    [self.context save:&error];
}



iphone: NSNumber to boolean and vice versa

NSNumber to Boolean
BOOL b = [num boolValue];

Boolean to NSNumber
num=[NSNumber numberWithBool:YES];