Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Latest commit

 

History

History
26 lines (19 loc) · 899 Bytes

Resizing.md

File metadata and controls

26 lines (19 loc) · 899 Bytes

Panel resizing

An advanced feature of PanelKit is the ability to resize panels while they are floating.

How to implement

To implement panel resizing, the PanelContentDelegate of a panel should implement the minimumPanelContentSize or/and the maximumPanelContentSize API. By default, both of these return the panel's preferredPanelContentSize, disabling resizing. When resizing is enabled, a handle will appear in the bottom right corner.

Example implementation

The following implementation will enable resizing:

extension MyPanelContentViewController: PanelContentDelegate {

    var preferredPanelContentSize: CGSize {
        return CGSize(width: 320, height: 240)
    }
	
    var minimumPanelContentSize: CGSize {
        return CGSize(width: 300, height: 200)
    }
	
    var maximumPanelContentSize: CGSize {
        return CGSize(width: 480, height: 640)
    }

}