Create Simple Basic Application in Iphone. Here I am giving you complete example with steps to develop First Application.
Step 1:
First of all you need xcode to develop ios application. If you have than let's starting...
When you launch Xcode it will open like this. For any new application just select create and new Xcode project.
Here you can see snapshot which contain all the things.
Product Name: Application Name
Organization name: you can give any name
Company identifier: you can type any name but it will ended with .com name..
bundle identifier: company identifier + product name
class prefix:All classes will be started with given name prifix( Ex. devangcontroller.h)
Devices:
1)universal for iphone and ipad
2)iphone
3)ipad
Storyboarding: it will give you page like board to design view from ios 5 onwards
Auto referencing counting for memory allocation/Deallocation
Unit Testing for testing app only
Step 4:
Here IT will give you all setting regarding application.
Step 5:
Now here you can see
devangAppdelegate.h :start first Application delegate header file
devangAppdelegate.m: start first Application delegate implementation file to start first viewcontroller initialization here blue dark part like devangViewController_iPad which is first executed file in it.
Now you can see right side bottom it is showing all controls in object library. Just dragged one right rect button from object library to your iphone view xib file.
Step 6:
Now select button and press ctrl key and drag it in view controller in header file. so this type of pop up will come there you can just type your name and select action in connection then it will create like
Step 7:
This snap will show you complete both files with code .
Devang Patel
Step 1:
First of all you need xcode to develop ios application. If you have than let's starting...
When you launch Xcode it will open like this. For any new application just select create and new Xcode project.
Step 2:
Here it will show you all types of application for ios devices like iphone,ipad and mac. Here I am just selecting single view application. and press next..
Step 3:
Product Name: Application Name
Organization name: you can give any name
Company identifier: you can type any name but it will ended with .com name..
bundle identifier: company identifier + product name
class prefix:All classes will be started with given name prifix( Ex. devangcontroller.h)
Devices:
1)universal for iphone and ipad
2)iphone
3)ipad
Storyboarding: it will give you page like board to design view from ios 5 onwards
Auto referencing counting for memory allocation/Deallocation
Unit Testing for testing app only
Step 4:
Here IT will give you all setting regarding application.
Now here you can see
devangAppdelegate.h :start first Application delegate header file
#import <UIKit/UIKit.h>
@class devangViewController;
@interface devangAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) devangViewController *viewController;
@end
devangAppdelegate.m: start first Application delegate implementation file to start first viewcontroller initialization here blue dark part like devangViewController_iPad which is first executed file in it.
#import "devangAppDelegate.h"
#import "devangViewController.h"
@implementation devangAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[devangViewController alloc] initWithNibName:@"devangViewController_iPhone" bundle:nil];
} else {
self.viewController = [[devangViewController alloc] initWithNibName:@"devangViewController_iPad" bundle:nil];
}
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
Now you can see right side bottom it is showing all controls in object library. Just dragged one right rect button from object library to your iphone view xib file.
Step 6:
Now select button and press ctrl key and drag it in view controller in header file. so this type of pop up will come there you can just type your name and select action in connection then it will create like
- (IBAction)PRESSME:(id)sender;it will same created in view controller.m file also where you can write your code so it will be executed in button click event.
Step 7:
This snap will show you complete both files with code .
Step 8: Here i am writing just alert view on button click event.
Step 9: Now see left side upper corner it will allow you to select simulator and press run button your application will run with "click ME" button. Now you can press button and get output...
devangViewController .h
#import <UIKit/UIKit.h>
@interface devangViewController : UIViewController
- (IBAction)PRESSME:(id)sender;
@end
devangViewController .m
#import "devangViewController.h"
@interface devangViewController ()
@end
@implementation devangViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)PRESSME:(id)sender {
UIAlertView *Alertfirst = [[UIAlertView alloc]
initWithTitle:@"My First App in Iphone" message:@"devang9978@gmail.com" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
// Display the Hello World Message
[Alertfirst show];
}
@end
This is Simple basic Application in ios developing but still you need any help from studyoverflow.org just leave comment on it or you can mail me on devang9978@gmail.com..
0 comments:
Post a Comment