Post

Replies

Boosts

Views

Activity

Reply to How to improve the captured image's resolution?
Thank you for your reply. My first question is, does the size of the capturedImage for the front facing camera increase according to the increase of the video format of ARFaceTrackingConfiguration? My second question is, displayTransform seems to be the prevalent way of converting the coordinates of the capturedImage to the camera image onscreen for ARKit. However, the method uses the normalized image coordinates from (0, 0) to (1, 1) which means shrinking an the captured image drastically and impacting the resolution negatively: let normalizeTransform: CGAffineTransform = CGAffineTransform(scaleX: 1.0 / imageSize.width, y: 1.0 / imageSize.height) Do you have any recommendation on how to achieve the coordinate conversion without such a drastic measure? My main objective is to convert the coordinate, orientation, and the size of the capturedImage to those of the image on screen.
Feb ’23
Reply to How to use additionalSafeAreaInsets
I understand where you're coming from, but that's not the point of this discussion. Also, I think view controller containment utilizes more than using a view controller as a dumb container. Anyways, would you be able to try running the code in your Playground? I've formatted it so that it can work in Playground.
Nov ’20
Reply to How to use additionalSafeAreaInsets
What is shown in the Apple documentation is in fact what I'm trying to do where there is one parent view controller and a child controller along with another view. The child view controller and the view are next to each other within the parent view controller set by additionalSafeAreaInsets. I've also tried applying the constraints, but still doesn't work:     secondVC.view.translatesAutoresizingMaskIntoConstraints = false     NSLayoutConstraint.activate([       secondVC.view.leadingAnchor.constraint(equalTo: self.leftView.safeAreaLayoutGuide.trailingAnchor),       secondVC.view.heightAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.heightAnchor),       secondVC.view.trailingAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.trailingAnchor)     ]) or     secondVC.view.translatesAutoresizingMaskIntoConstraints = false     NSLayoutConstraint.activate([       secondVC.view.leadingAnchor.constraint(equalTo: self.leftView.trailingAnchor),       secondVC.view.heightAnchor.constraint(equalTo: self.view.heightAnchor),       secondVC.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor)     ])
Nov ’20
Reply to How to use additionalSafeAreaInsets
@OOPer I understand what you're saying and that was initially what I thought as well, but even when I tried to impose the additional insets to MyVC, the super view controller, instead to SecondVC, it still doesn't provide the spacing. So instead of: secondVC.additionalSafeAreaInsets = newSafeArea I tried: self.additionalSafeAreaInsets = newEdgeInsets it made no difference. I tried keeping the additionalSafeAreaInsets to SecondVC and adding a child view controller, AnotherVC, to SecondVC to see if it provides the insets, but didn't: class SecondVC: UIViewController {   let anotherVC = AnotherVC()   override func viewDidLoad() {     super.viewDidLoad()           self.view.backgroundColor = .yellow     addChild(anotherVC)     self.view.addSubview(anotherVC.view)     anotherVC.didMove(toParent: self)             } } class AnotherVC: UIViewController {   override func viewDidLoad() {     super.viewDidLoad()     self.view.backgroundColor = .purple   } } As far as I understand, safe areas, unlike regular margins, are imposed by a view controller and propagated down the view hierarchy or the child view controller hierarchy. This is intentional so that if there is a top bar or a bottom tab bar, all the subviews and child VC's will also be safe from being covered by those bars. So it was my assumption that when we are adding the safe area, we are adding to the existing one from the parent view controller. Apple's example from this documentation - https://developer.apple.com/documentation/uikit/uiview/positioning_content_relative_to_the_safe_area also shows that the additional insets are being added to the child view controller to achieve what I'm trying to achieve: override func viewDidAppear(_ animated: Bool) {   var newSafeArea = UIEdgeInsets()   // Adjust the safe area to accommodate   // the width of the side view.   if let sideViewWidth = sideView?.bounds.size.width {     newSafeArea.right += sideViewWidth   }   // Adjust the safe area to accommodate   // the height of the bottom view.   if let bottomViewHeight = bottomView?.bounds.size.height {     newSafeArea.bottom += bottomViewHeight   }   // Adjust the safe area insets of the   // embedded child view controller.   let child = self.childViewControllers[0]   child.additionalSafeAreaInsets = newSafeArea }
Nov ’20
Reply to The File’s Owner object of a NIB file
It sounds like it's all semantics at this point and the File's Owner is one and the same as the "self" that's calling the NIB. But, isn't Nuburg saying that File's Owner exists even before Bundle.main.loadNibNamed("SomeNIBFile", owner: self ) is executed? Instead, the nib-loading mechanism substitutes the real, already existing instance for the nib owner object, using the real instance to fulfill any connections that involve the nib owner. When A substitutes for B, A and B are separate entities (ex. I'm substituting stevia for sugar). "The real, already existing instance" is A, which is what you're referring to as "self" in your example. B is the nib owner object which exists as an instance prior to "self" replacing it.
Nov ’20