Thursday, July 7, 2011

Short Codes useful for mac apps



Hi!

This blog will contain some very basic concepts that we mostly use in iphone apps but not sure how to implement in MacApps.Hope it will save your time in researching.


1. Loading a url in a webView for Mac App


[ [web mainFrame ] loadRequest: [ NSURLRequest requestWithURL: [NSURL URLWithString:@"http://www.google.com/" ] ];

Here ,"web" is an object of WebView.

2. Get the tableView row number that was selected (using single tap)


For this you need to set the tableView delegate & use the below method
- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row{
rowSelected = row;
return YES;
}

3. Showing an alert Message


NSString *theAlertMessage = [NSString stringWithFormat: @"Already added to rhymes sticky."];
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert setAlertStyle:NSCriticalAlertStyle];
[alert addButtonWithTitle:@"OK"];
[alert setMessageText:theAlertMessage];

4 comments:

  1. Swati, really very useful codes which we generally not able to implement in MacApps. Your post always give some new stuff related to the iPhone apps code and how to use that on the iPhone. Thanks for another useful information.
    Shame Alarm iPhone App

    ReplyDelete
  2. hi swathi ...... can u plz change the background theme.Probably its difficult to understand text under black color.

    ReplyDelete
  3. swathi..... i got stuck in my ios app . do u have any idea ,how to implement video chat in ios app using web services?????? waiting 4 ur reply??

    ReplyDelete