Simple Progress HUD – iPhone

SimpleProgressHUD es un HUD muy sencillo y ligero de para iOS.

Instalación

  • Incluye la carpeta de ProgressHUD en tu proyecto.
  • Importa el header de ProgressHUD.h donde quiera que lo necesites.

Uso

Ver el proyecto de ejemplo en Xcode /Demo

SimpleProgressHUD se crea como un singleton, por lo que no tiene que ser instanciado de manera explicita, se puede llamar de manera directa [ProgressHUD defaultHUD], utilizando para mostrar el HUD lo siguiente:

- showInView:(UIView*)view;

Y para descartarlo:

-(void) hideActivityIndicator;
Automatic Reference Counting (ARC) support

Si estas usando ARC en tu proyecto basta con eliminar el metodo -dealloc en  la Clase de ProgressHUD.

Puedes obtener una copia del codigo en GitHub.

Nota: SimpleProgressHUD esta inspirado en Sam Vermette’s SVProgressHUD para iOS.

The bundle is invalid. The key CFBundleVersion in the info.plist must contain a higher version than that of the previously uploaded version.

Cuando yo estaba tratando de ”validar” mi aplicación (usando Xcode) para hacer una actualización de mi aplicación en iTunes Connect, por una razón desconocida que estaba recibiendo este mensaje de error:The key CFBundleVersion in the info.plist must contain a higher version than that of the previously uploaded version.

Si tienes el mismo problema, puede resolverlo de la siguiente manera:

  1. Abre el sitio de iTunes Connect, después click en Manage Your Applications >  ”Tu App” > View Details (boton de la esquina izq.) > Binary Details.
  2. Allí podrás ver  el “Bundle Version”, después todo lo que necesitas hacer es actualizar el Bundle Version de tu App.

Al principio supuse  que el ”Bundle Version” para fines iTunesConnect era el que se puede ver en “Version Information”, pero parece que Apple utilizan datos diferentes para esos fines.

Espero haber sido de ayuda.

Singleton en Objective-c

Uno de los patrones de diseño mas utilizados es el singleton. El singleton es usado para instanciar solo una vez una clase. Encontre un template para un singleton en objective-c el cual quiero compartir con ustedes.

Pero para este caso usare un singleton para guardar/retener un valor de tipo NSString

A continuación pongo el código para el singleton.

MySingleton.h

#import <Foundation/Foundation.h>

@interface MySingleton : NSObject {

    NSString *stringValue;

}

+ (MySingleton *)sharedMySingleton;

- (NSString *)stringValue;
- (void)setStringValue:(NSString *)value;

@end

MySingleton.m

#import "MySingleton.h"

@implementation MySingleton

static MySingleton* _sharedMySingleton = nil;

+(MySingleton*)sharedMySingleton
{
	@synchronized([MySingleton class])
	{
		if (!_sharedMySingleton)
			[[self alloc] init];

		return _sharedMySingleton;
	}

	return nil;
}

+(id)alloc
{
	@synchronized([MySingleton class])
	{
		NSAssert(_sharedMySingleton == nil, @"Attempted to allocate a second instance of a singleton.");
		_sharedMySingleton = [super alloc];
		return _sharedMySingleton;
	}

	return nil;
}

-(id)init {
	self = [super init];
	if (self != nil) {
		// initialize stuff here
        stringValue = nil;
	}

	return self;
}

- (NSString *)stringValue{
    return stringValue;
}
- (void)setStringValue:(NSString *)value{
    stringValue = value;
}

@end

Si quieres Guardar(Set) el stringValue, usamos lo siguiente:

[[MySingleton sharedMySingleton] setStringValue:@"Hello World"];

Y si quieres obtener(Get) el stringValue, usamos lo siguiente:

[[MySingleton sharedMySingleton] stringValue];

Puedes descargar una copia de un código funcional de github

Fuente del Post : getsetgames

Incorporar Youtube Video en iPad

Here I put a small tutorial for embedded a youtube video on iPad also works on iPhone.

Note: The iPad/iPhone simulator does not allow online reproduction, the video will only be visible in a real device .

  1. First we create a View-based Application project.
  2. I will name it EmbeddedVideo, you can name it whatever you like.
  3. Open the EmbeddedVideoViewController.xib and added a UIWebView(drag and drop).

  4. Then in EmbeddedVideoViewController.h create an IBOutlet for ourUIWebView, leaving something like this:
    @interface EmbeddedVideoViewController : UIViewController {
       UIWebView *webVideo;
    }
    
    @property (nonatomic, retain) IBOutlet UIWebView *webVideo;
    
    @end
  5. We connect the IBOutlet with UIWebView, open the  EmbeddedVideoViewController.xib and  in File’s Owner in the Outlets section select/drag on our UIWebView:
  6. We opened in EmbeddedVideoViewController.m within viewDidLoad method (if commented, uncomment it) add a few lines of code, something like this:
    - (void)viewDidLoad
    {
           [super viewDidLoad];
           NSString *videoURL = @"http://www.youtube.com/watch?v=JOddp-nlNvQ";
           NSString *htmlString =[[NSString alloc] initWithFormat:@" ",videoURL];
           [webVideo setAllowsInlineMediaPlayback:YES];
           [webVideo loadHTMLString:htmlString baseURL:nil];
    }
  7. After that compile and run on our device and we’ll see something like this

I hope this will be useful and you can download the code from  here