Funny behavior of ImageView

Discussion in 'Mac Programming' started by Trisect Develop, Jul 3, 2013.

  1. macrumors newbie

    Joined:
    Jun 28, 2013
    Location:
    Denmark
    #1
    I have an ImageView in my application.
    When I load an image into my ImageView I change the size of it with the SetFrame command, and that seems to work okay.
    I make the ImageView bigger.

    On my window form I also go a NSPopupButton and when I click on it my ImageView set its frame to the starting value. Its going back the the size it has when I start my application.

    I have tried many things but I can figure out why it shrinks my ImageView back.

    Does any one here know why is is like that?
     
  2. thread starter macrumors newbie

    Joined:
    Jun 28, 2013
    Location:
    Denmark
    #2
    I have tried to set breakpoints on every line that includes the setFrame command, but no code gets called when I click in my NSPopUpButton.

    I really hope that someone can help me.
     
  3. macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #3
    If you used Interface Builder (IB) and the button is a part of that construction, then select the button in IB and check the connections panel. Is the button connected to any outlet or action. If connected to an action, place a break point on the first line of the method. If not an action, but an outlet, check all references to the outlet (instance variable) and see if you are assigning a action to it.

    If the above doesn't reveal anything, then try turning off AutoLayout for that IB view. I mention this as a shot in the dark. :confused:

    You may need to post some code or screen shots for people to help further.

    That's all I have.
     
  4. thread starter macrumors newbie

    Joined:
    Jun 28, 2013
    Location:
    Denmark
    #4
    Sadly the Autolayout idea did not work.

    This is the code for the action for the popupbutton.
    Code:
     
       [ivTemporyImageAA setFrame:bigScreenshot];
        
        NSLog(@"height=%f", ivTemporyImageAA.frame.size.height);
        NSLog(@"widht=%f", ivTemporyImageAA.frame.size.width);
    
    I set the frame for my ImageVIew and display the size in nslog.

    This is how I set the sized in applicationDidFinishLoading.
    Code:
        smallIcon = NSMakeRect(262, 257, 100, 100);
        bigScreenshot = NSMakeRect(262, 98, 155, 259);
    
    So when I load an image into my ImageView it size is set to bigScreenshot and it look okay on the screen.

    Then when I select a value in my popupbutton and called the previous code the ImageView gets small again. Ignoring the code in the action.

    The nslog show the right values, but something after the nslog code resize the ImageView back to the small size.
     

Share This Page