1. "Show splash screen during loading"

    Mon 11 May 2009

    //In AppDelegate.m

    - (void)applicationDidFinishLaunching:(UIApplication *)application {

     

    m_viewController = [[SplashViewController alloc] initWithNibName:nil bundle:nil];

    [window addSubview:m_viewController.view];

    [window makeKeyAndVisible];

     

    //set delay before showing new screen

    [NSTimer scheduledTimerWithTimeInterval:5.0f target:self selector:@selector(onSlashScreenExpired:) userInfo:nil repeats:NO];

    }

     

    - (void)onSlashScreenExpired:(id)userInfo{

    [m_viewController.view removeFromSuperview];

    [window addSubview:[navigationController view ...

    read more
  2. "UnZip NSData"

    Mon 11 May 2009

    NSURL *xmlURL =  [[NSURL alloc] initWithString:streamerURLString2];

    NSData *data = [[NSData alloc] initWithContentsOfURL:xmlURL];

     

    //unzip data

    NSData *unzippedData = [data inflate];


    read more
  3. "Create TextField (UITextField) in runtime"

    Mon 11 May 2009

    UITextField *loginTextField = [[UITextField alloc] initWithFrame:CGRectMake(20, 104, 285, 23)];

     

    loginTextField.borderStyle = UITextBorderStyleBezel;

    loginTextField.textColor = [UIColor blackColor];

    loginTextField.font = [UIFont systemFontOfSize:14.0];

    loginTextField.placeholder = @"<enter email>";

    loginTextField.backgroundColor = [UIColor whiteColor];

    loginTextField.autocorrectionType = UITextAutocorrectionTypeNo; // no auto correction support

     

    loginTextField.keyboardType = UIKeyboardTypeEmailAddress; // use the default type input method (entire keyboard)

    loginTextField ...

    read more
  4. "Get path (Documents Folder) to save file on device"

    Mon 11 May 2009

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

    NSString *documentsDirectory = [paths objectAtIndex:0];

    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"yourfile.txt"];

    read more
  5. "Generate GUID on iPhone"

    Mon 11 May 2009

    +(NSString*)GUIDString {

        CFUUIDRef theUUID = CFUUIDCreate(NULL);

        CFStringRef string = CFUUIDCreateString(NULL, theUUID);

        CFRelease(theUUID);

        return [(NSString *)string autorelease];

    }

    read more
  6. "Export from SVN and ZIP with date/time in filename"

    Mon 11 May 2009

    #!/bin/bash

    #Export folder from SVN

    #ZIP it and add date and time to file name 

    svn export https://svn.server.com/svn/ --force --username myusername --password mypassword NameOutFolder

    filename= NameOutFolder$(date "+_%m_%d_%y_%k_%M")

    zip -r -q $filename.zip NameOutFolder

    read more

« Page 9 / 13 »