0

Is it possible to have an CKComponent without an view to handle a tap gesture?

I just found this solution WITH a view:

...

+ (instancetype)newWithViewModel:(NewsComponentViewModel *)viewModel
{
    CKComponent *comp = ...;
    return [super
            newWithView:{
                [UIView class],
                {CKComponentTapGestureAttribute(@selector(didTapView))}
            }
            component:comp];
}
Onno
  • 35
  • 5
  • No, since you have to have a view to attach a `UIGestureRecognizer` to. Otherwise you would have to attach to the superview, which is likely not confining the hotspot to the area you would like. – Jonathan Crooke Jun 02 '15 at 12:26

1 Answers1

1

@itsthejb is correct. You must have a view to handle actions.

Adam Ernst
  • 52,440
  • 18
  • 59
  • 71