strange

Discussion in 'iOS Programming' started by chhoda, Dec 29, 2008.

  1. macrumors 6502

    Joined:
    Oct 25, 2008
    #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
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    And you've added slider_max.png to your project?
     

Share This Page