iOS crash - exit on removeFromSuperview

IDMah

macrumors 6502
Original poster
May 13, 2011
287
9
Hi all.

Trying to keep My View from being blurry.
So I'm trying to remove the old views.

with:

Code:
UIView *removeView;
while((removeView = [self viewWithTag:999]) != nil) {
	[removeView removeFromSuperview];
}
which I set up with:
Code:
UIImage *uiimage = [[UIImage alloc]retain]; 
uiimage = [currentCard stampImage]; 
CGSize mysize = uiimage.size; 
UIGraphicsBeginImageContext(mysize);
	
[uiimage drawInRect:CGRectMake(stampPost.x,stampPost.y, stampSize.width, stampSize.height)
blendMode:kCGBlendModeNormal alpha:alpahed]; 

UIImage* blendedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
		
UIImageView *stampOverlay = [[UIImageView alloc] initWithImage:blendedImage]; 
	
[blendedImage release];

[stampOverlay setFrame:CGRectMake(0,0,bounds.size.width,bounds.size.height)];
[stampOverlay setAlpha:STAMPBASE];
[stampOverlay setTag:999];
	
[self addSubview:stampOverlay];
[stampOverlay release];
I even tried to set the set the Views Alpha to 0.0f and that crashed too..
basically I want the redraws to be cleared. before I draw update (redraw) the view.

thanks
Ian
 
Last edited:

IDMah

macrumors 6502
Original poster
May 13, 2011
287
9
Code in an NSView.

It draws a card on the screen an populates it. the card is part of an XIB.

thanks
Ian

oh and the above code is in
Code:
-(void)drawCard
{
// stuff // 
}

// which is called by

 - (void)drawRect:(CGRect)rect {
 if cardtype = 1
{
  [self drawCard];
}
}
 
Last edited:

IDMah

macrumors 6502
Original poster
May 13, 2011
287
9
it's actually in a routine that get's called by drawRect. But Point taken.

Not sure for now.. will more than likely have to rethink how I do things
to make it work. I just I'll just hide the views for now.. ugly bad, but ..
It seems to work..

will Post a solution if I find one..

thanks
Ian