Note that there are some explanatory texts on larger screens.

plurals
  1. POObj-C, Potential leak of an object allocated on line, warning?
    primarykey
    data
    text
    <p>I've declared the following variable as an instance variable and am using it in my m file, however I've getting a warning.</p> <pre><code>TransparentToolbar *tools; </code></pre> <p>Potential leak of an object allocated on line ...</p> <p>I' have tried creating a property for it, for example..</p> <pre><code>@property (nonatomic, retain) TransparentToolbar *tools; </code></pre> <p>And synthesize'ing and releasing it, but my view crashes at the end of dealloc.</p> <p>What am I doing wrong ?</p> <p>EDIT same warning on pickerSortingDataCurrent ...</p> <pre><code>h @interface myViewController : UIViewController &lt;UIActionSheetDelegate, UIPickerViewDelegate, UIPickerViewDataSource, UITableViewDelegate, UITableViewDataSource, MFMailComposeViewControllerDelegate&gt; { TransparentToolbar *tools; NSArray *pickerSortingDataCurrent; } @property (nonatomic, retain) TransparentToolbar *tools; @property (nonatomic, retain) NSArray *pickerSortingDataCurrent; m @synthesize pickerSortingDataCurrent; @synthesize tools; - (void)viewDidLoad { [super viewDidLoad]; tools = [[[TransparentToolbar alloc] initWithFrame:CGRectMake(0, 0, 70, 44.01)] autorelease]; tools.barStyle = UIBarStyleBlackOpaque; self.pickerSortingDataCurrent = [[NSArray alloc] initWithObjects: @"Next Date Ascending", @"Next Date Descending", nil]; // removed some items here } - (void)dealloc { [tools release]; [pickerSortingDataCurrent release]; [super dealloc]; } </code></pre> <p>Ahhhh I have autorelease.... but that doesn't solve the pickerSortingDataCurrent ...</p> <p>EDIT...</p> <pre><code>#import "TransparentToolbar.h" @implementation TransparentToolbar - (void)drawRect:(CGRect)rect { // do nothing in here } - (void) applyTranslucentBackground { self.backgroundColor = [UIColor clearColor]; self.opaque = NO; self.translucent = YES; } - (id) init { self = [super init]; [self applyTranslucentBackground]; return self; } // Override initWithFrame. - (id) initWithFrame:(CGRect) frame { self = [super initWithFrame:frame]; [self applyTranslucentBackground]; return self; } @end </code></pre> <p>FURTHER EDIT <img src="https://i.stack.imgur.com/LojrT.jpg" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload