alexhillc / AXPhotoViewer

An iOS/tvOS photo gallery viewer, useful for viewing a large (or small!) number of photos.
https://www.cocoacontrols.com/controls/axphotoviewer
MIT License
646 stars 119 forks source link

Gap with custom title view #47

Open gdetari opened 6 years ago

gdetari commented 6 years ago

I am trying to achieve a custom look for the overlay view.

My goal is to have the information about the photo in the top , and the navigation stuff in the bottom (basically the reverse of the default).

As far as I understand there are two ways to customize the appearance of the overlay:

  1. Add views to the top and bottom stackview containers of the AXOverlayView. This doesn't do what I want, since the title view will still remain, and any views will be added below

  2. Replace the title view, by supplying a custom UIView, conforming to AXOverlayTitleViewProtocol. Now this is what I want. However, when I do so, it seems that no matter what I do, there is a gap between the edge of the view controller and my custom view like so:

Screenshot

Here is the code I use:

class CustomView: UIView, AXOverlayTitleViewProtocol {
//empty
}

...

let v = CustomView(frame: self.view.frame) //no matter what frame I use
v.backgroundColor = UIColor.red
photosViewController.overlayView.titleView = v
self.present(photosViewController, animated: true)

Please let me know what am I missing.