Frage

My iOS 7 app has a UIViewController with a UIMapView on it. It also has a small view with a UIButton on it that is displayed over the map when the user drags the map outside the current search area. When it is displayed, the user can tap the button to search for more POIs around the current map center.

I am using Apple's BannerViewController from the iAd Suite sample code so I can display one ad banner across multiple views. This required me to embed the view controller in a container so that the BannerViewController could show/hide the ad. Now, when the small view with the button on it is displayed, touching the button does not trigger the Touch Up Inside event like it did before.

I am using Interface Builder and have checked all of the views in the view hierarchy and they all have User Interaction Enabled. Here is what the view hierarchy looks like in IB:

BannerViewController MapViewController

I know this is probably something dumb I am not thinking of, but I have been looking at it too long and need some help.

Thanks in advance.

UPDATE #1:

I removed the UIButton from the small view and replaced it with a tap gesture recognizer and still nothing. It appears that the view itself is not getting any touch events.

UPDATE #2:

Bringing the button to to the front using bringSubviewToFront does not help.

Update #3:

Here's a list of the subviews of the container view controller:

<__NSArrayM 0x17c74ea0>(
<MKMapView: 0x15ddfe40; frame = (0 0; 320 367); clipsToBounds = YES; autoresize = TM+BM; layer = <CALayer: 0x15de1e90>>,
<UIView: 0x17c00030; frame = (0 317; 320 50); alpha = 0; autoresize = TM+BM; layer = <CALayer: 0x15d42dc0>>,
<_UILayoutGuide: 0x17c000f0; frame = (0 0; 0 0); hidden = YES; layer = <CALayer: 0x17c75400>>,
<_UILayoutGuide: 0x17c00160; frame = (0 0; 0 0); hidden = YES; layer = <CALayer: 0x17c751d0>>
)
War es hilfreich?

Lösung

I was right, it was stupid. After all of everyone's comments, I checked the container and I had set no auto layout constraints on it. From my experience, this means that it will be created with all zeros for it's frame. Once I added those constraints, everything started working fine again.

Thanks to all who helped me track this down.

Andere Tipps

if you are trying on iOS simulator .Please quit the iOS Simulator and run again your app if every thing is right there in your code .

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top