我已經使用集合視圖單元格來顯示多個圖像。然後每個圖像右上角有一個小圖標。我的問題是如何將點按手勢添加到每個單元格圖像右上角的小圖標。Ios- Ipad- UicollectionViewCell-單元格上的圖標 - 如何將點按手勢添加到xcode 5中的圖標?
我的代碼:
UITapGestureRecognizer *tapped = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(projectSetting:)];
_projectSettingIconButton = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"login-settings.png"]];
_projectSettingIconButton.frame = CGRectMake(95, 3, 21, 21);
[_projectSettingIconButton addGestureRecognizer:tapped];
[cell addSubview:_projectSettingIconButton];
你忘了添加代碼 –
UITapGestureRecognizer * tapped = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(projectSetting :)]; _projectSettingIconButton = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@「login-settings.png」]]; _projectSettingIconButton.frame = CGRectMake(95,3,21,21); [_projectSettingIconButton addGestureRecognizer:tapped]; [cell addSubview:_projectSettingIconButton]; –
由謝謝你來幫助我(幫助我),..... –