performSegueWithIdentifier:sender里边的sender是啥意思
2015-07-15 09:43
579 查看
performSegueWithIdentifier:sender里边的sender是啥意思啊?怎样用啊?
[self performSegueWithIdentifier:@"pushSign" sender:self];
[self performSegueWithIdentifier:@"pushSign" sender:sender];
[self performSegueWithIdentifier:@"pushSign" sender:cell];
等等看到了,很多sender的用法,然后很糊涂,不知道这个sender指的是啥?怎样去使用他
sender是参数名称,理论上可以指代任何对象,具体看方法的定义。
通常情况下,sender常用于传递消息的发送者,可以理解为触发方法的对象。
比如给一个按钮加入触摸事件。
[button addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
-(void)action:(id)sender{
//这里的sender就是上面的button
}
如果有两个button
[button addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
[button2 addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
-(void)action:(id)sender{
//这里可以根据判断sender来确定是触摸了哪个按钮
}
相关文章推荐
- - (void)performSegueWithIdentifier:(NSString *)identifier sender:(nullable id)sender 失效
- performSegueWithIdentifier 不生效的解决办法
- SQL创建表里边的with是什么意思
- -[MIInstallableBundle performVerificationWithError:]: 502: Upgrade's application-identifier entitlem
- a different object with the same identifier value was already associated withthe session异常解决方案
- cancelPreviousPerformRequestsWithTarget
- 开发中遇到的hibernate异常:a different object with the same identifier value was already associated with the
- 关于Hibernate:No row with the given identifier exists报错的解决办法
- a different object with the same identifier value was already associated with the session
- 【Android策略】Can not perform this action after onSaveInstanceState with DialogFragment
- a different object with the same identifier value was already associated with the session
- 收集:Hibernate中常见问题 No row with the given identifier exists问题的原因及解决
- a different object with the same identifier value was already associated with the session
- Hibernate异常:a different object with the same identifier value
- 解决a different object with the same identifier value was already associated with the session错误
- 对于dequeueReusableCellWithIdentifier:的个人理解
- A different object with the same identifier value was already associated with the session
- iOS 真机调试错误 An App ID with Identifier 'xxx.xxx' is not available. Please enter a differen
- storyboard之 prepareForSegue:sender:
- 关于TableViewCell生成时dequeueReusableCellWithIdentifier的认识