Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chhoda

macrumors 6502
Original poster
Oct 25, 2008
285
1
@implementation SliderView

- (void) touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {

MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
MainViewController *mainVC = appDelegate.mainViewController;

CGRect rect = [self frame];
CGRect rectMV = [mainVC.channelPicker.moreView frame];
CGRect rectCP = [mainVC.channelPicker frame];
if(rect.origin.y < rectCP.origin.y) // it is in min position
{
CGPoint pt = CGPointMake(rectCP.origin.x + (rect.size.width / 2), rectMV.origin.y + (rect.size.height / 2));
UIImage *img = [UIImage imageNamed:mad:"slider_max.png"];
[self setImage:img]; //[UIImage imageNamed:mad:"slider_mini.png"];
[mainVC.channelPicker.moreView removeFromSuperview];
[mainVC.channelPicker removeFromSuperview];
[self setCenter:pt];
}
else // It is in max position
{
mainVC.channelPicker.moreView.hidden = FALSE;
mainVC.channelPicker.hidden = FALSE;
CGPoint pt = CGPointMake(rectCP.origin.x + (rect.size.width / 2), rectCP.origin.y - (rect.size.height/2)); //rectMV.origin.y;
[self setImage:[UIImage imageNamed:mad:"slider_mini.png"]];
[self setCenter:pt];
}
}


my class is inherited from UIImage class. Surprisingly in the else part self setImage works fine. in the if part self setImage crashes EXC_BAD_ACCESS

both the images are valid and are returing valid pointers.

Any ideas !!!

regards
ch
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.