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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to