Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

CURSO iOS

Al crear una single view applicartion tenemoslos siguientes archivos:


El siguiente mtodo se ejecuta luego de que la aplicacin se haya
cargado:
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
return YES;
}
Se ejecuta luego de que la aplicacin va desde estar a activa a modo inactivo.
- (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:.
}

Main Story board


Aqu va como la historia de la aplicacin, movimiento entre ventanas,
etc etc
Para hacer un hola mundo, hacemos lo siguiente: el NSLog sirve para
imprimir algn mensaje en pantalla
int a=4;
// Do any additional setup after loading the view, typically from a nib.
NSLog(@"hola mundo %i",a);

Creacin de objetos y llamar a sus mtodos.


NSString *ejemplo1 = @"holita";
NSString *ejemplo2 = [[NSString alloc] init];
NSString *ejemplo3 = [NSString stringWithFormat:@"Esta es una frase de
ejemplo %i %@", 3, ejemplo1];
BOOL *hjhjhj = [ejemplo1 isEqualToString:@"hola"];
IBOUTLET & IBACTION
El es IBOUTLET es para relacionar el cdigo con el objeto en el storyboard, para
ellos, ponemos el objeto en la imagen del proyecto y y en el viewcontroller.h
poneomos lo siguiente:
@property (nonatomic, retain) IBOutlet UIButton *boton;

En el viewcontroller.m ponemos :
@synthesize boton;

El IBACTION es lo que nos sirve para crear el mtodo de algn objeto,


por ejemplo cuando se oprime algn botn.

En el .h se pone el encabezado
-

(IBAction)pulsarboton:(id)sender;

y en el .m se pone :
- (IBAction)pulsarboton:(id)sender{
[etiqueta setText:campotexto.text];
}

Lo que hace el mtodo anterior es poner en etiqueta el texto obtenido


de campo texto.
CARsan44

You might also like