我正在为Iphone的SMS应用程序工作.. 现在我想在longpress上更改聊天气泡的图像(就像我复制内容一样)..
我有这个代码..
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默认已完成我想做同样的...任何人都可以帮助我...
答案 0 :(得分:2)
您似乎必须检查状态是否为 UIGestureRecognizerStateRecognized 以更改聊天气泡的颜色,
if (longPressRecognizer.state == UIGestureRecognizerStateRecognized) {
// Change Chat bubble's color to blue
}
答案 1 :(得分:1)
长按手势开始状态时检查颜色为红色
if (longPressRecognizer.state == UIGestureRecognizerStateBegan)
{
[self becomeFirstResponder];
// change image from here
//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 ");
}
}
else if (longPressRecognizer.state == UIGestureRecognizerStateChanged)
{
//load original image here...
}