Posts

DropBox integration to iPhone Application

In one of my iPhone application i wanted to integrate DropBox to share things. I just visited the DropBox developer site : https://www.dropbox.com/developers/reference/sdk and downloaded the sdk for iOS and the tutorial for integration. DropBox has really made it very easy to integrate and have provided an awesome documentation. I followed the steps, made some modifications and i was done. You can download the sample code: Download

Parse CSV file in Objective C

Sometimes we have a bulk of data in a .csv file which we need to add or access in our iOS Application. For this we can add that .csv file in application's bundle, fetch data from it and store it in an NSArray for use. Follow the steps: 1. Once list of Country Names so i downloaded the full-country-list.csv from internet and added it in my application's bundle by simply dragging it. 2. Now i just located that file path and stored in 'strPath' variable, then stored its contents and encoding type in 'strFile' variable. 3. Checked if file is present and i am able to read it. 4. Now i allocated & initialized an NSArray object 'arrayCountry'. 5. To parse file use 'strFile componentsSeparatedByString:@"\n"' and store it in arrayCountry. This .csv file is seperated with new line character, if .csv is seperated by comma use ',' instead of '\n'. 6. And we are done with parsing .csv file and we have all country nam...

Integrating Facebook and Twitter using Social Framework iOS 6

Image
Lets checkout how to integrate and start sharing using Facebook and Twitter using Social Framework provided in iOS 6 Source code:  Download

Launch iOS Application From Safari Using CustomURLScheme

If you want to take user back from Safari to your iOS Application, you can achieve it using custom url scheme. Follow the steps: 1. Open -info.plist file and add <key> CFBundleURLTypes </key> <array> <dict> <key> CFBundleURLSchemes </key> <array> <string> myapplicationurl </string> </array> </dict> </array> 2. Above code will register a custom url for your application. 3. You can also pass parameters (query string) to it: myapplicationurl:// myapplicationurl://?key1=value1&amp;key2=value2 4. When this url is called from Safari iPhone SDK sends message to UIApplicationDelegate - ( BOOL )application:( UIApplication *)application handleOpenURL:( NSURL *)url {  // You are back to your application.  NSLog ( @"Yeah!!! We are back to Application from Safari" );  return YES ; } 5. Above method in UIApplicationDelegate wil...

Integrating Pinterest in iOS Application

Image
Pinterest do not provide api's for integration yet. So in order to achieve it we need to use UIWebView in iOS App. Follow below steps: 1. Take a UIViewController containing two buttons, one UIWebView. 2. Generate HTML programatically and pass it to loadHTMLString in UIWebView. 3. On touchup-inside of first button, load html string which will open Pinterest in UIWebView. 4. Here pass your custom description and image url which you want to pin. 5. On touchup-inside of second button, close/hide the UIWebView. Download Code from here:  PinterestiOSIntegration http://stackoverflow.com/questions/9909511/ios-application-integration-with-pinterest answer provided by ' wzbozon' Above link helped me out.

Open htaccess Password Protected Web-Page in UIWebView

In some cases we want to access a password protected (htaccess) webpage from UIWebView iPhone. So for this we need add username and password between 'http://' and 'page url'.  e.g. @"http://username:password@192.165.1.11/mypage" NSString *url = @"http://username:password@192.165.1.11/mypage"; [webViewForhtaccessPageRendering loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: url]]]; here  webViewForhtaccessPageRendering is UIWebVIew.

UITableView - Add or Remove Rows Dynamically (Objective C & Swift Source codes)

Image
In some situations we need to add or remove rows dynamically from a UITableView. We can achieve it very easily, just got through the tutorial : 1. Create a new project. 2.  In AppDelegate implementation file create an object of UINavigationController (navController here). 3. Add object of UIViewController (viewController here) as rootviewcontroller of UINavigationController. 4. In ViewController.xib nib file take a UITableView. 5. Set delegate and datasource of UITableView to File's Owner. 6. Create an IBOutlet to UITableView (tableViewForScreen here) in ViewControler.h header file. 7. Declare an object of NSMutableArray (arrayForTableContent here) in ViewControler.h header file. 8. In ViewController.m file in viewDidLoad method set edit and add buttons as leftBarButtonItem and rightBarButtonItem respectively. 9. Initialize arrayForTableContent array and add objects to it. ...