Can TTImageView has click event?
I subclassed TTTableMessageItem to show user response, and I want to add click event on user avatar image (I knew it is a TTImage开发者_JAVA百科View in TTTableMessageItemCell). How to ?
I work it out as below:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
if ([touch view] == myImageView)
{
// do process
}
}
You may find it easier to simple add a gesture recogniser to the view - touchesBegan
is certainly acceptable, but gesture recognisers are somewhat simpler and probably more suited to a tap detection event.
精彩评论