Monday, March 26, 2012

New app - PhotoUploads Lite (Free version)

New app "PhotoUploads Lite" is available in App Store.

This app lets you to upload the photos to Facebook, Flickr and Dropbox, and view the photos in the account.

http://itunes.apple.com/us/app/photouploads-lite/id511228591?mt=8

 

Sunday, March 25, 2012

To ping the server to determine if it is reachable

Here is the method to ping if the server is reachable.


- (BOOL)canPingServer {
    
    NSString *serverAddress = urlField.text;
    
    NSLog(@"ping domain: %@", serverAddress);
    
    Reachability* reachability = [[Reachability reachabilityWithHostName: serverAddress] retain];
    NetworkStatus netStatus = [reachability currentReachabilityStatus];
    
    if ((netStatus == ReachableViaWWAN) || (netStatus == ReachableViaWiFi)) 
            return YES;
    else 
            return NO;
    
}

Saturday, March 24, 2012

Dismiss UIAlertView without clicking the button

If need to dismiss the UIAlertView without clicking the button, we could use the below method.



-(void) showAlert {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Connecting to server" message:@"Please wait ..." delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
[alert show];
}

-(void) anotherMethod {
yourCode...add the below method
[alert dismissWithClickedButtonIndex:0 animated:TRUE];
[alert release];
}



Saturday, March 17, 2012

NSMutableDictionary - write and read

Write value for key:
[progressDict setObject:@"Uploading ..." forKey:@"status"];
[progressDict setObject:[NSNumber numberWithInt:i] forKey:@"progress"];

Read value for key:
NSLog(@"key is status, value is %@",[dict objectForKey:@"status"]);
NSLog(@"key is progress, value is %@",[dict objectForKey:@"progress"] );

Saturday, March 3, 2012

Grab the image Data from web or mainBundle

-(void) grabImagefromURL
{
    NSURL *url = [NSURL URLWithString:@"http://cultofmac.cultofmaccom.netdna-cdn.com/wp-content/uploads/2010/01/apple-vs-google_2.jpg"];
    imageData = [NSData dataWithContentsOfURL:url];
    UIImage *image  = [[UIImage alloc] initWithData:imageData];
    myImageView.image = image;
    [image release];
    
}

- (void) grabImagefromFile
{

    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"lion" ofType:@"jpg"]; 

    UIImage *image = [UIImage imageWithContentsOfFile:filePath];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:img];
    [self.view addSubview:imageView];

Set multi-lines in the label

Set the lines = 0 in the label tab, then the text can be shown as the multi-line in the UILabel. Actually it can be done in code too.

Mac - Screen capture


Command +Shift+3 
It captures entire screen and saves it in the desktop.

Command +Shift+4 
Use the mouse to select a specific area of the screen for capture saves it in the desktop, press ESC to dismiss.



Cmd+Ctrl+Shift 3
It captures the screenshot and keep it in clipboard


Cmd+Ctrl+Shift 4
It captures the selected screenshot and keep it in clipboard