-2
我想選擇一個UILongPressGestureRecognizer操作相關聯,並且選擇對應於接收一個參數的函數。與參數選擇加入一個動作
所以我的問題是,我怎麼能設置UILongPressGestureRecognizer行動選擇,並將它傳遞參數?
我的功能(選擇)是:
-(void)MyFunction:(NSInteger)paramether
{
//some code
}
,我把它在UILongPressGestureRecognizer這裏:
longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(MyFunction)];
如果MyFunction的有任何paramether它會工作正常,但如果我將其設置爲接收一些paramether它不會工作
爲了避免'無法識別的選擇器'錯誤,請使用'@selector(MyFunction :))'替換'@selector(MyFunction)'。 – Larme
問題不完全在於此。 但如何傳遞給myFunction – mmarques
例如,我想這樣做@選擇一個特定的值(MyFunction的:4) 和4是給myFunction的說法 – mmarques