iphone - Alloc class instance -
i have class:
@class uiimagepicker; @protocol uiimagepickerdelegate<nsobject> @required - (void)didfinishchooseimage:(uiimagepicker *)picker withimage:(uiimage*)img; @end @interface uiimagepicker : nsobject <uinavigationcontrollerdelegate, uiimagepickercontrollerdelegate> { uiimagepickercontroller *imgpicker; } @property (assign) int type; @property (nonatomic, retain) uiimagepickercontroller *imgpicker; @property (nonatomic,assign) id <uiimagepickerdelegate> delegate;
and how alloc imgpicker
:
-(void)showimagepicker{ imgpicker = [[uiimagepickercontroller alloc] init]; imgpicker.allowsediting = yes; imgpicker.delegate = self; //trigger photo library function if (self.type == 0) { imgpicker.sourcetype = uiimagepickercontrollersourcetypephotolibrary; } else { imgpicker.sourcetype = uiimagepickercontrollersourcetypecamera; } }
and how release imgpicker
:
- (void)dealloc { [imgpicker release],imgpicker = nil; [super dealloc]; }
did release in dealloc ok? or need add release because imgpicker retain property??
Comments
Post a Comment