Conviene que el icono de nuestra aplicación lo hagamos de 512 x 512 pixels porque cuando subamos la aplicación a la AppleStore nos va a pedir una imagen de ese tamaño.
Además deberíamos crear imágenes con los siguientes tamaños para los distintos dispositivos:
Iphone: 57 x 57 pixels
High Resolution Iphone/Ipod: 114 x114 pixels
Ipad: 72 x 72 pixels
High Resolution Ipad: 144 x 144 pixels
Hola a todos! Este blog surge a partir de que no encontraba muchos recursos en español para aprender Objective-C. Espero que les sea útil! ;)
jueves, 23 de febrero de 2012
miércoles, 8 de febrero de 2012
Crear un botón por código
// Creo el boton y lo inicio con un frame que creo con la funcion CGRectMake.
UIButton *reservaButton = [[UIButton alloc] initWithFrame:CGRectMake(230, 45, 76, 25)];
// El boton tiene una imagen, la agrego como background
[reservaButton setBackgroundImage:[[UIImage imageNamed:@"reservar.png"]
stretchableImageWithLeftCapWidth:75.0 topCapHeight:0.0]
forState:UIControlStateNormal];
// Enlazo el boton con el método reserve
[reservaButton addTarget:self
action:@selector(reserve:)
forControlEvents:UIControlEventTouchUpInside];
martes, 7 de febrero de 2012
martes, 31 de enero de 2012
Agregar pin a un mapa
Lo conveniente es crear una nueva clase que llamaremos Pin:
Pin.h
#import "Pin.h"
Luego agregamos al mapa el pin:
Pin.h
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>
@interface Pin : NSObject{
CLLocationCoordinate2D coordinate;
NSString *subtitle;
NSString *title;
}
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
@property (nonatomic,retain)NSString *subtitle;
@property (nonatomic,retain) NSString *title;
- (id) initWithCoords:(CLLocationCoordinate2D) coords;
@end
Pin.m #import "Pin.h"
@implementation Pin
@synthesize coordinate;
@synthesize subtitle;
@synthesize title;
- (id) initWithCoords:(CLLocationCoordinate2D) coords{
self = [super init];
if (self != nil)
coordinate = coords;
return self;
}
- (void) dealloc{
[title release];
[subtitle release];
[super dealloc];
}
@end
Luego agregamos al mapa el pin:
CLLocationCoordinate2D pinlocation; pinlocation.latitude = latitude; pinlocation.longitude = longitude; Pin *pin = [[Pin alloc] initWithCoords:pinlocation]; pin.title = self.tituloSel; [mapa removeAnnotations:[mapa annotations]]; [mapa addAnnotation:pin]; [pin release];
miércoles, 18 de enero de 2012
Mostrar otra pantalla
self.infoController = [[InformationViewController alloc]
initWithNibName:@"InformationViewController"
bundle:[NSBundle mainBundle]];
[self presentModalViewController:infoController animated:YES];
y para volver desde esa nueva pantalla
[self dismissModalViewControllerAnimated:YES];
Otra forma de pasar a otra pantalla
progressView = [[ProgressViewController alloc] initWithNibName:@"ProgressViewController" bundle:nil];
[self.view addSubview:progressView.view];
domingo, 1 de enero de 2012
viernes, 30 de diciembre de 2011
Obtener una subcadena de un objeto String
NSString *str = @"Hola Mundo"; NSString *newStr = [str substringWithRange:NSMakeRange(0,4)];newStr sería igual a "Hola".
Suscribirse a:
Entradas (Atom)