View Full Version : Funny behavior of ImageView
Jul 3, 2013, 02:12 PM
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?
Jul 4, 2013, 09:59 AM
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.
Jul 4, 2013, 12:27 PM
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.
Jul 4, 2013, 02:05 PM
Sadly the Autolayout idea did not work.
This is the code for the action for the popupbutton.
I set the frame for my ImageVIew and display the size in nslog.
This is how I set the sized in applicationDidFinishLoading.
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.