Alloc class instance

I Have this class:

@class UIImagePicker;

@protocol UIImagePickerDelegate<NSObject>

- (void)didFinishChooseImage:(UIImagePicker *)picker withImage:(UIImage*)img;


@interface UIImagePicker : NSObject <UINavigationControllerDelegate, UIImagePickerControllerDelegate> {
    UIImagePickerController *imgPicker;

@property (assign) int type;
@property (nonatomic, retain) UIImagePickerController *imgPicker;
@property (nonatomic,assign) id <UIImagePickerDelegate> delegate;

And this is how i am alloc the imgPicker:

    imgPicker = [[UIImagePickerController alloc] init];
    imgPicker.allowsEditing = YES;
    imgPicker.delegate = self;

    //Trigger get photo from library function
    if (self.type == 0) {
        imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    } else {
        imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;

And this is how i release the imgPicker:

- (void)dealloc
    [imgPicker release],imgPicker = nil;
    [super dealloc];

Did the release in the dealloc is ok? or i need to add another release because the imgPicker is with retain property??


Need Your Help

Resolving HttpRequestScoped services in ASMX with Autofac 2.1.12

asmx autofac

The Description I had a legacy type that is HttpRequestScoped and a legacy web service consuming that service. To resolve services in legacy concerns, I have a global resolver. This was all working...

insert date into SQL

c# .net sql tsql

I'm trying to insert a date into a SQL table, but it when the program runs it gives the following error.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.