Frage

I am trying trying to copy all of the functionality of this example app provided by Apple called AVCam: https://developer.apple.com/library/ios/samplecode/AVCam/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010112-Intro-DontLinkElementID_2

I am 99% done with copying this code, but I just have one final problem. I have an IBOutlet statement that looks like this: @property (nonatomic, weak) IBOutlet MediaCapturePreviewView *previewView;

According to the Apple sample code, this outlet is supposed to be connected to a View object that has been placed on top of the normal/default view.

Here is a screenshot of what the Connections Inspector looks like in the Apple example:

enter image description here

You will notice that the IBOutlet called "previewView" has been connected to something called the "Cam Preview View".

Also, in this screenshot, you can see that I am able to select this View object by itself and that it shows a Referencing Outlet in it's connections inspector for the same IBOutlet and View Object:

enter image description here

My problem is that I cannot get the IBOutlet code to connect to this View Object. I have tried the normal behavior of clicking and dragging to make the connections but it just wants to create a new outlet. It will not let me connect to the outlet that I have already created.

I have been playing with this for 2 hours now and just can't get it to work like Apple's sample code.

Any help is greatly appreciated thank you.

War es hilfreich?

Lösung

In your .xib file, make sure that UIView class is assigned as AVCamPreviewView instead of UIView.

enter image description here

Andere Tipps

A few possible solutions:

  1. Save the file with the IBOutlet you're trying to connect up (the source code, not the IB)
  2. Clean, rebuild
  3. Restart Xcode.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top