如何更改 UILongPressGestureRecognizer 上的图像?
我正在为Iphone开发短信应用程序.. 现在我想在长按时更改聊天气泡的图像(就像我复制内容时一样)..
我有这个代码..
if (longPressRecognizer.state == UIGestureRecognizerStateBegan)
{
[self becomeFirstResponder];
//NSIndexPath *pressedIndexPath = [tblOutgoingMessagesRecords indexPathForRowAtPoint:[longPressRecognizer locationInView:tblOutgoingMessagesRecords]];
NSIndexPath *pressedIndexPath = [tblOutgoingMessagesRecords indexPathForCell:(UITableViewCell *)longPressRecognizer.view];
if (pressedIndexPath && (pressedIndexPath.row != NSNotFound) && (pressedIndexPath.section != NSNotFound))
{
[self becomeFirstResponder];
NSLog(@" Presssed on Copy ");
我只想在长按它进行复制时将我的聊天气泡颜色更改为蓝色.. 就像iPhone默认所做的那样,我想做同样的事情......任何人都可以帮助我......
I am working on SMS application for Iphone ..
And now i want to change image of my chat bubble on longpress ( like while i copy the contant )..
i have this code ..
if (longPressRecognizer.state == UIGestureRecognizerStateBegan)
{
[self becomeFirstResponder];
//NSIndexPath *pressedIndexPath = [tblOutgoingMessagesRecords indexPathForRowAtPoint:[longPressRecognizer locationInView:tblOutgoingMessagesRecords]];
NSIndexPath *pressedIndexPath = [tblOutgoingMessagesRecords indexPathForCell:(UITableViewCell *)longPressRecognizer.view];
if (pressedIndexPath && (pressedIndexPath.row != NSNotFound) && (pressedIndexPath.section != NSNotFound))
{
[self becomeFirstResponder];
NSLog(@" Presssed on Copy ");
I just want to change my Chat bubble color to blue while i lonpress it for copy ..
As like in iphone default has done i want to do same ... Can any one help me ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来您必须检查状态是否为UIGestureRecognizerStateRecognized才能更改聊天气泡的颜色,
It seems you have to check if the state is UIGestureRecognizerStateRecognized to change the Chat bubble's color,
当长按手势开始条件时检查颜色为红色
check color to red when long press gesture begin condition