author | sheepluva |
Sat, 10 Dec 2016 21:28:10 +0100 | |
changeset 12112 | 0695302f3f5f |
parent 11256 | 3dc674af7662 |
child 12877 | 00215a7ec5f5 |
permissions | -rw-r--r-- |
4476
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
1 |
/* |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
2 |
* Hedgewars-iOS, a Hedgewars port for iOS devices |
6700 | 3 |
* Copyright (c) 2009-2012 Vittorio Giovara <vittorio.giovara@gmail.com> |
4476
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
4 |
* |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
8 |
* |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
13 |
* |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
8441
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
4476
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
17 |
*/ |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
18 |
|
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
19 |
|
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
20 |
#import "HoldTableViewCell.h" |
11256
3dc674af7662
- FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
11135
diff
changeset
|
21 |
#import "UITableViewCell+FindTable.h" |
6832 | 22 |
|
4476
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
23 |
@implementation HoldTableViewCell |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
24 |
@synthesize delegate; |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
25 |
|
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
26 |
#define SWIPE_DRAG_HORIZ_MIN 10 |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
27 |
#define SWIPE_DRAG_VERT_MAX 40 |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
28 |
|
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
29 |
-(id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
30 |
if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) { |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
31 |
delegate = nil; |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
32 |
} |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
33 |
return self; |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
34 |
} |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
35 |
|
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
36 |
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { |
4486 | 37 |
UITouch *touch = [[event allTouches] anyObject]; |
8441 | 38 |
|
39 |
time = touch.timestamp; |
|
4486 | 40 |
[self performSelector:@selector(holdAction) withObject:nil afterDelay:0.25]; |
4476
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
41 |
|
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
42 |
[super touchesBegan:touches withEvent:event]; |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
43 |
} |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
44 |
|
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
45 |
-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { |
4486 | 46 |
UITouch *touch = [[event allTouches] anyObject]; |
8441 | 47 |
|
4486 | 48 |
if ( touch.timestamp - time < 0.25 ) { |
49 |
[NSObject cancelPreviousPerformRequestsWithTarget:self |
|
50 |
selector:@selector(holdAction) |
|
51 |
object:nil]; |
|
8441 | 52 |
|
4486 | 53 |
[super touchesEnded:touches withEvent:event]; |
54 |
} else |
|
55 |
[super touchesCancelled:touches withEvent:event]; |
|
4476
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
56 |
} |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
57 |
|
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
58 |
-(void) holdAction { |
6115
485cfecadc9a
HUGE refactoring of the ipad interface, finally understood how to use interface builder with custom uiviewcontrollers, as well as converted some uitableviewcontrollers to uiviewcontrollers for simplicity
koda
parents:
4976
diff
changeset
|
59 |
if (self.delegate != nil && [self.delegate respondsToSelector:@selector(holdAction:onTable:)]) |
11135
b34c0e2b546a
- Fix for 'hold for delete' for cells in teams table
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
60 |
{ |
b34c0e2b546a
- Fix for 'hold for delete' for cells in teams table
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
61 |
UITableView *tableView = [self findTable]; |
b34c0e2b546a
- Fix for 'hold for delete' for cells in teams table
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
62 |
if (tableView) |
b34c0e2b546a
- Fix for 'hold for delete' for cells in teams table
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
63 |
{ |
b34c0e2b546a
- Fix for 'hold for delete' for cells in teams table
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
64 |
[self.delegate holdAction:self.textLabel.text onTable:tableView]; |
b34c0e2b546a
- Fix for 'hold for delete' for cells in teams table
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
65 |
} |
b34c0e2b546a
- Fix for 'hold for delete' for cells in teams table
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
66 |
} |
b34c0e2b546a
- Fix for 'hold for delete' for cells in teams table
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
67 |
} |
b34c0e2b546a
- Fix for 'hold for delete' for cells in teams table
antonc27 <antonc27@mail.ru>
parents:
10108
diff
changeset
|
68 |
|
4476
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
69 |
-(void) dealloc { |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
70 |
self.delegate = nil; |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
71 |
[super dealloc]; |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
72 |
} |
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
73 |
|
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
diff
changeset
|
74 |
@end |