0

I use a CNContactViewController in a NSTabViewController as well as a NSPopover. In both cases the ViewController has a size that is too small (See red color in Screenshot).

The other tabs use all available space, like one would expect.

enter image description here

I tried to set the frame of the ViewController upon viewWillAppear but this is ignored:

override func viewWillAppear() {
    for i in tabViewItems{
        if let vc = i.viewController as? CNContactViewController{
            vc.contact = CNContact.dummyContact()
            vc.view.frame = view.frame
            vc.view.layer?.backgroundColor = NSColor.red.cgColor
            view.layer?.backgroundColor = NSColor.green.cgColor
        }
    }
}

In a popover the height is the same:

same-problem

Update

I do get this error when launching the app, however, I don't have access to the constraints on ABRemotePersonView, so I am at a loss.

[133:9106090] [Layout] Detected missing constraints for <ABRemotePersonView: 0x6080001411e0>. It cannot be placed because there are not enough constraints to fully define the size and origin. Add the missing constraints, or set translatesAutoresizingMaskIntoConstraints=YES and constraints will be generated for you. If this view is laid out manually on macOS 10.12 and later, you may choose to not call [super layout] from your override. Set a breakpoint on DETECTED_MISSING_CONSTRAINTS to debug. This error will only be logged once.

Community
  • 1
  • 1
Besi
  • 22,579
  • 24
  • 131
  • 223
  • Sound more like bug in internal implementation (bugreport.apple.com). I would try to play with lldb and subviews to get the instance of ABRemotePersonView and set the frame size manually. (Production -> always test respondsToSelector ...) – Marek H Jan 31 '17 at 09:08
  • Second suggestion, try to move the code to viewDidLoad. 2 years back I asked similar question here. TSI confirmed bug. – Marek H Jan 31 '17 at 09:15

0 Answers0