开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜