Is there a UIView resize event?

前端 未结 7 2145
难免孤独
难免孤独 2020-11-28 03:29

I have a view that has rows and columns of imageviews in it.

If this view is resized, I need to rearrange the imageviews positions.

This view is a subview of

7条回答
  •  孤独总比滥情好
    2020-11-28 03:58

    You can create a subclass of UIView and override the

    setFrame:(CGRect)frame

    method. This is the method called when the frame (i.e. the size) of the view is changed. Do something like this:

    - (void) setFrame:(CGRect)frame
    {
      // Call the parent class to move the view
      [super setFrame:frame];
    
      // Do your custom code here.
    }
    

提交回复
热议问题