
objective-c怎么代码触发按钮点击事件
2个回答
2016-07-05
展开全部
在控件基类 UIView 上面重实现一组函数
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
然后根据鼠标点击位置和动作,判断手势,这是比较原始的事件通知了,如果你需要判断高级的手势,比如滑动,多点触控,则可以用系统的手势分析类 来处理。但是事件都是从这里来的。
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
然后根据鼠标点击位置和动作,判断手势,这是比较原始的事件通知了,如果你需要判断高级的手势,比如滑动,多点触控,则可以用系统的手势分析类 来处理。但是事件都是从这里来的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
看你想实现什么效果,最基本的用 pushViewController
MyViewController *myView = [[MyViewController alloc] init];
[self.navigationController pushViewController:myView animated:YES];
或者动画
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4f]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationTransition:UIViewAnimationOptionTransitionNone forView:myView cache:YES];
[myView setCenter:CGPointMake(512, 384)];
[UIView commitAnimations];
MyViewController *myView = [[MyViewController alloc] init];
[self.navigationController pushViewController:myView animated:YES];
或者动画
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4f]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationTransition:UIViewAnimationOptionTransitionNone forView:myView cache:YES];
[myView setCenter:CGPointMake(512, 384)];
[UIView commitAnimations];
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询