objective c - Addsubview issues -
objective c - Addsubview issues -
i pretty new in coding in objective-c , have been stucked couple of hours view management issue. based on matt gemmel roudedfloatingpannel, display nsimage nice semi-transparent rounded background.
//create transparent window window = [[transparentwindow alloc] initwithcontentrect:contentrect stylemask:nsborderlesswindowmask backing:nsbackingstorebuffered defer:no]; //add rounded background [window setcontentview:[[roundedview alloc] init]]; //get running application nsarray *runningapps = [[nsworkspace sharedworkspace] runningapplications]; //prepare test image view nsimage *image = [[runningapps objectatindex:9] icon]; nsimageview *img = [[nsimageview alloc] init]; [img setimage:image]; //display icon [[window contentview] addsubview:img];
it seems doing wrong, background displayed. help me on ?
thanks in advance. gael.
first of all, leaking objects:
[window setcontentview:[[roundedview alloc] init]]; ... nsimageview *img = [[nsimageview alloc] init];
those should autoreleased.
as specific issue, suggest stepping through code debugger , check each statement executes expected (e.g., objects allocate not nil). help hunting downwards problem.
objective-c addsubview
Comments
Post a Comment