• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem getting events when adding Subviews
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem getting events when adding Subviews


  • Subject: Problem getting events when adding Subviews
  • From: Dave <email@hidden>
  • Date: Thu, 10 Jul 2014 18:16:39 +0100

I forgot to say, this is for iOS7 iPad only.


Hi,

I have a View Controller that Build “Banner” Views in code and then adds them to a viewControllers View Hierarchy. There can be 0, 1 or 2 banners displayed at any time under program control.

I decided to use a Parent View Controller to manage the Banners and add Child View Controllers to this Parent. This all works fine as far as being displayed is concerned. It also works fine if just one “Banner” is visible at a time, however if both are being displayed then events are only sent to one of the two banners — the last one (in the View Hierarchy) that is added.

Events to the last Banner get through ok and events for the child view controller get through ok too, but not for the first “Banner” that was enabled, e.g.

e.g.

[myBanner1 enable];
[myBanner2 enable];  — only events for myBanner2 get through to the action handler.

or

[myBanner2 enable];
[myBanner1 enable];  — only events for myBanner1 get through to the action handler.

Please see a dump of the View Controller’s View Hierarchy below. I’ve also tried removing the "Banner Container View” and just adding the two banner view’s to View Controller’s .view property but the same thing happens.

Any one have an idea of what I am doing wrong?

Thanks a lot
Dave

ViewController.view - Loaded from NIB via initWithNibName: bundle
SubViews of Base View: 0xba4e130 - class: UIView Tag: 9999 		Frame: 0.000000,0.000000,768.000000,1024.000000


View Loaded from NIB via initWithNibName: bundle:
SubViews of View: 0xba4e190 - class: UILabel Tag: 9999 Frame: 48.000000,26.000000,362.000000,21.000000


Banner Container View Added by Code.
SubViews of View: 0xba41f30 - class: UIView Tag: 1000 Frame: 0.000000,0.000000,1024.000000,768.000000

 Banner1 - Added by Code.
 SubViews of View: 0xbb5cd70 - class: LTWBannerView Tag: 1001 Frame: 0.000000,0.000000,1024.000000,768.000000
   SubViews of View: 0xbb66d00 - class: UIView Tag: 0 Frame: 0.000000,20.000000,1024.000000,100.000000

 Banner1 Item - Added By Code. An Action is added to the UIButton Object.
     SubViews of View: 0xba34820 - class: LTWBannerItemView Tag: 0 Frame: 0.000000,0.000000,1024.000000,100.000000
       SubViews of View: 0xbb80d80 - class: UIImageView Tag: 1 Frame: 0.000000,0.000000,1024.000000,100.000000
       SubViews of View: 0xbb8d020 - class: UIButton Tag: 2 Frame: 0.000000,0.000000,1024.000000,100.000000
         SubViews of View: 0xbb7c560 - class: UIButtonLabel Tag: 0 Frame: 440.000000,11.000000,144.000000,77.000000

 Banner2 - Added by Code. An Action is added to the UIButton Object.
 SubViews of View: 0xbb672d0 - class: LTWBannerView Tag: 1002 Frame: 0.000000,0.000000,1024.000000,768.000000
   SubViews of View: 0xbb60cb0 - class: UIView Tag: 0 Frame: 0.000000,608.000000,1024.000000,160.000000
     SubViews of View: 0xbb93910 - class: LTWBannerItemView Tag: 0 Frame: 0.000000,0.000000,256.000000,160.000000
       SubViews of View: 0xbb8df30 - class: UIImageView Tag: 1 Frame: 0.000000,0.000000,256.000000,160.000000
       SubViews of View: 0xbb8e980 - class: UIButton Tag: 2 Frame: 0.000000,0.000000,256.000000,160.000000
         SubViews of View: 0xbb8dfb0 - class: UIButtonLabel Tag: 0 Frame: 43.000000,41.000000,170.000000,77.000000

     SubViews of View: 0xbb89870 - class: LTWBannerItemView Tag: 0 Frame: 256.000000,0.000000,256.000000,160.000000
       SubViews of View: 0xbb898e0 - class: UIImageView Tag: 1 Frame: 0.000000,0.000000,256.000000,160.000000
       SubViews of View: 0xbb92370 - class: UIButton Tag: 2 Frame: 0.000000,0.000000,256.000000,160.000000
         SubViews of View: 0xbb6c860 - class: UIButtonLabel Tag: 0 Frame: 50.000000,41.000000,156.000000,77.000000

     SubViews of View: 0xbb8ff30 - class: LTWBannerItemView Tag: 0 Frame: 512.000000,0.000000,256.000000,160.000000
       SubViews of View: 0xbb8bb00 - class: UIImageView Tag: 1 Frame: 0.000000,0.000000,256.000000,160.000000
       SubViews of View: 0xbb8bbb0 - class: UIButton Tag: 2 Frame: 0.000000,0.000000,256.000000,160.000000
         SubViews of View: 0xbb8bcd0 - class: UIButtonLabel Tag: 0 Frame: 29.000000,41.000000,197.000000,77.000000

     SubViews of View: 0xbb87190 - class: LTWBannerItemView Tag: 0 Frame: 768.000000,0.000000,256.000000,160.000000
       SubViews of View: 0xbb87230 - class: UIImageView Tag: 1 Frame: 0.000000,0.000000,256.000000,160.000000
       SubViews of View: 0xbb872e0 - class: UIButton Tag: 2 Frame: 0.000000,0.000000,256.000000,160.000000
         SubViews of View: 0xbb87420 - class: UIButtonLabel Tag: 0 Frame: 13.000000,41.000000,230.000000,77.000000

Child View Controller Loaded from NIB and added by Code using the addChildViewController method.
SubViews of View: 0xb741780 - class: UIView Tag: 7777 Frame: 0.000000,100.000000,1024.000000,508.000000
 SubViews of View: 0xb738fd0 - class: UILabel Tag: 7777 Frame: 174.000000,100.000000,97.000000,21.000000
 SubViews of View: 0xb7370b0 - class: UIButton Tag: 0 Frame: 212.000000,287.000000,110.000000,30.000000
   SubViews of View: 0xb745180 - class: UIButtonLabel Tag: 0 Frame: 0.000000,6.000000,110.000000,18.000000




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Prev by Date: Problem getting events when adding Subviews
  • Next by Date: Converting SenTesting framework tests to XCTests
  • Previous by thread: Problem getting events when adding Subviews
  • Next by thread: Converting SenTesting framework tests to XCTests
  • Index(es):
    • Date
    • Thread