• 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
UIButton events on a CALayer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UIButton events on a CALayer


  • Subject: UIButton events on a CALayer
  • From: Ian was here <email@hidden>
  • Date: Mon, 29 Jul 2013 17:52:46 -0700 (PDT)

I've added a UIButton to a CALayer. The button appears as it should, but the button won't send a touch event. I've Googled around on this subject, but haven't found a solution that works in this case. Has anyone come across this issue?

Below is the source.


UIButton *prefsButton = [[UIButton alloc] initWithFrame:CGRectMake( 0.0, 0.0, 50.0, 40.0 )];
[prefsButton setTitle:@"Prefs" forState:UIControlStateNormal];
[prefsButton setBackgroundColor:[UIColor grayColor]];
[prefsButton addTarget:self action:@selector(showPreferences:) forControlEvents:UIControlEventTouchDown];
[view addSubview:prefsButton];


CALayer *prefsLayer = [prefsButton layer];

[prefsLayer setFrame:CGRectMake( x, y, 50.0, 40.0 )];
[controlBarLayer addSublayer:prefsLayer];
_______________________________________________

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


  • Follow-Ups:
    • Re: UIButton events on a CALayer
      • From: David Duncan <email@hidden>
    • Re: UIButton events on a CALayer
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Getting a splash screen to show
  • Next by Date: Re: UITableView Cell reordering when cell size is larger than screen size
  • Previous by thread: Re: Getting a splash screen to show
  • Next by thread: Re: UIButton events on a CALayer
  • Index(es):
    • Date
    • Thread