我有一個顯示圖片的UIImageView。點擊並按住時,只要用戶將手指放在圖像視圖上,就會使其變暗。基本上,我希望它像UIButton一樣行事。突出顯示(點擊)時,如何使UIImageView變暗?
我現在已經將其與UIGestureRecognizer做到這一點:
- (void)viewDidLoad
{
[super viewDidLoad];
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(pictureViewTapped)];
singleTap.numberOfTapsRequired = 1;
singleTap.numberOfTouchesRequired = 1;
[self.pictureImageView addGestureRecognizer:singleTap];
[self.pictureImageView setUserInteractionEnabled:YES];
}
,並在我的pictureViewTapped
,我(現在)有這樣的:
- (void)pictureViewTapped {
NSLog(@"Picture view was tapped!");
}
如何使暗的UIImageView?任何幫助表示讚賞。
如果您想表現得像一個按鈕,爲什麼不使用按鈕? – danypata 2013-05-12 18:49:13