Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Is this code correct?</p> <pre><code> UIImageView* framebadgeOrAccessoryImage = [[UIImageView alloc]initWithFrame:sizeOfFrameOrAccessoriesView]; [framebadgeOrAccessoryImage setCenter:imageArea.center]; [framebadgeOrAccessoryImage setContentMode:UIViewContentModeScaleAspectFit]; [framebadgeOrAccessoryImage setImage:badgeOrAccessoryImage]; [framebadgeOrAccessoryImage setTag:iObjectTag]; [framebadgeOrAccessoryImage setObservationInfo:@"BadgeAccessories"]; [framebadgeOrAccessoryImage setExclusiveTouch:YES]; iObjectTag++; [framebadgeOrAccessoryImage setMultipleTouchEnabled:YES]; [framebadgeOrAccessoryImage setBackgroundColor:[UIColor clearColor]]; [framebadgeOrAccessoryImage setUserInteractionEnabled:YES]; [imageArea addSubview:framebadgeOrAccessoryImage]; selectedItem = framebadgeOrAccessoryImage; [framebadgeOrAccessoryImage release]; </code></pre> <p>I am using "framebadgeOrAccessoryImage" in my other methods using the tag which I have set. Do I have to just release "framebadgeOrAccessoryImage" as I have done in the last line of the code or assign it to nil after releasing it?</p> <p>"framebadgeOrAccessoryImage" is used here with the name "selectedItem". </p> <pre><code>- (void)panRecognized:(UIPanGestureRecognizer *)gestureRecognizer { if(selectedItem.image &amp;&amp; [gestureRecognizer isEnabled]) { UIImageView *piece = selectedItem; if ((([gestureRecognizer state] == UIGestureRecognizerStateBegan || [gestureRecognizer state] == UIGestureRecognizerStateChanged)) &amp;&amp; [((NSString*) [piece observationInfo]) isEqualToString:@"BadgeAccessories"]) { CGPoint translation = [gestureRecognizer translationInView:[piece superview]]; [piece setCenter:CGPointMake([piece center].x + translation.x, [piece center].y + translation.y)]; [gestureRecognizer setTranslation:CGPointZero inView:[piece superview]]; } if ([gestureRecognizer state] == UIGestureRecognizerStateEnded ||[gestureRecognizer state] == UIGestureRecognizerStateCancelled || [gestureRecognizer state] == UIGestureRecognizerStateFailed) { if(CGRectContainsPoint([[self view]viewWithTag:RECYCLEBIN_TAG].frame, [gestureRecognizer locationInView:imageArea])) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc]init]; [objectsAdded removeObjectForKey:[NSString stringWithFormat:@"%d",selectedItem.tag]]; [pool release]; [UIView beginAnimations:NULL context:nil]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:0.4]; [UIView setAnimationDidStopSelector:@selector(propDeleted:finished:context:)]; [UIView setAnimationDelegate:self]; [selectedItem setFrame:CGRectMake(selectedItem.frame.origin.x, selectedItem.frame.origin.y, 5, 5)]; selectedItem.center = [[[self view]viewWithTag:RECYCLEBIN_TAG]center]; [UIView commitAnimations]; } else { [self applyEffectOnTouch:0]; } } } } </code></pre>
    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.
    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