Posts

Showing posts with the label Objective C

Need a Facebook App ID before you create a new project with the SDK.

Image
You will need a Facebook App ID before you create a new project with the SDK. 1 . Create a new app on the  Facebook App Dashboard , enter your app's basic information. Once created, note the app ID shown at the top of the dashboard page.  Alternatively, you can of course use the ID of an existing app. Now, you need to set the Bundle Identifier and configure your Facebook application to support login from an iOS application. (Note: this is a new step in the Facebook SDK for iOS v3.1. Previous versions of the SDK did not require this step.) Click on the checkmark next to “Native iOS App” and supply your Bundle Identifier in the “Bundle ID” field. In addition, make sure the Facebook Login radio button is set to “Enabled”. You can find or set your Bundle Identifier in Xcode in the Project tab. 3. Configure a new Xcode Project Create a new Xcode project, add the Facebook SDK for iOS, its dependencies, and the Facebook App ID to its settings In Xcode, create a new pr...

How to upload images with text using iPhone SDK using ASIHttpRequest ?

Code .h file. #import @interface RootViewController : UIViewController {         NSMutableArray *arrImages;     IBOutlet UIButton *btnImage1;     IBOutlet UIButton *btnImage2;     IBOutlet UIButton *btnImage3;     IBOutlet UIButton *btnImage4; } - (IBAction)btnTakePicture_Clicked:(id)sender; - (IBAction)btnPostImages_Clicked:(id)sender; @end Code .m file. #import "RootViewController.h" #import "ASIFormDataRequest.h" @implementation RootViewController int intButton; #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad {     [super viewDidLoad];     self.title = @"Select Images";     arrImages = [[NSMutableArray alloc]init]; } - (IBAction)btnTakePicture_Clicked:(id)sender {     UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Select Image from..." delegate:self cancelButtonTitle:@"Cancel" destruc...

How to draw a pie chart using iPhone sdk?

Image
Here’s one way to draw a PIE chart using the latest iPhone SDK. There are a ton of tutorials out there that let you get started with the iPhone app development itself and I am by no means any authoritative source on learning how to develop one. Having said that, here’s a class file that will help you use the UIKit and Quartz to draw vector graphics.  GraphView.h 1 2 3 4 5 6 7 8 9 10 11 12 # #(nothing to see here) #   #import <UIKit/UIKit.h> #import <Foundation/Foundation.h>   @interface GraphView : UIView {   }   @end GraphView.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 #import "GraphView.h"   #define PI 3.14159265358979323846 static inline float radians ( double degrees ) { return degrees * PI / 180 ; }   @implementation GraphView   - ( void ) drawRect : ( CGRect ) rect { ...

How to validate email id in iPhone SDK?

Image
This is prefect method to validate email address valid or not. In this method I'm using " NSPredicate" and "Name Regex" to validate email-ID NSString *email = textFieldemail.text; NSString *emailRegEx = @"(?:[a-z0-9!#$% \\ &'*+/=? \\ ^_`{|}~-]+(?: \\ .[a-z0-9!#$% \\ &'*+/=? \\ ^_`{|}" @"~-]+)*| \" (?:[ \\ x01- \\ x08 \\ x0b \\ x0c \\ x0e- \\ x1f \\ x21 \\ x23- \\ x5b \\ x5d- \\ " @"x7f]| \\\\ [ \\ x01- \\ x09 \\ x0b \\ x0c \\ x0e- \\ x7f])* \" )@(?:(?:[a-z0-9](?:[a-" @"z0-9-]*[a-z0-9])? \\ .)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?| \\ [(?:(?:25[0-5" @"]|2[0-4][0-9]|[01]?[0-9][0-9]?) \\ .){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-" @"9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[ \\ x01- \\ x08 \\ x0b \\ x0c \\ x0e- \\ x1f \\ x21" @"- \\ x5a \\ x53- \\ x7f]| \\\\ [ \\ x01- \\ x09 \\ x0b \\ x0c \\ x0e- \\ x7f])+) \\ ])"; NSPredicate *regExPredicate = [NSPredicate predicateWithFormat:@"SELF...

How to use nsxmlparser in Iphone SDk?

Image
NSXMLParser is a forward only reader or an event driven parser. What it means is, an event is raised whenever the parser comes across a start of an element, value, CDATA and so on. The delegate of NSXMLParser can then implement these events to capture XML data. Some of the events are raised multiple times like the start of an element, value of an element and so on. Since NSXMLParser is known as an event driven parser, we can only read data at the present node and cannot go back. The iPhone only supports  NSXMLParser  and not  NSXMLDocument , which loads the whole XML tree in memory. Books Application To understand how to use an instance of NSXMLParser, let’s create a simple navigation based application where we will list the title of the book in the table view and upon selecting a title, display the detail information in a detail view. Click  here  to see the sample XML file, used in this application. Create a new application in XCode by selecting Navig...