Skip to content

Commit 798d052

Browse files
author
UQ Times
committed
ヘッダからインスタンス変数を削除
1 parent 6b9daa7 commit 798d052

File tree

5 files changed

+105
-240
lines changed

5 files changed

+105
-240
lines changed

GestureRecognizers/GestureRecognizers.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@
219219
"$(inherited)",
220220
);
221221
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
222+
GCC_THUMB_SUPPORT = NO;
223+
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
224+
"GCC_THUMB_SUPPORT[arch=armv7]" = YES;
222225
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
223226
GCC_WARN_ABOUT_RETURN_TYPE = YES;
224227
GCC_WARN_UNINITIALIZED_AUTOS = YES;
@@ -240,6 +243,9 @@
240243
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
241244
COPY_PHASE_STRIP = YES;
242245
GCC_C_LANGUAGE_STANDARD = gnu99;
246+
GCC_THUMB_SUPPORT = NO;
247+
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
248+
"GCC_THUMB_SUPPORT[arch=armv7]" = YES;
243249
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
244250
GCC_WARN_ABOUT_RETURN_TYPE = YES;
245251
GCC_WARN_UNINITIALIZED_AUTOS = YES;
@@ -257,6 +263,7 @@
257263
buildSettings = {
258264
GCC_PRECOMPILE_PREFIX_HEADER = YES;
259265
GCC_PREFIX_HEADER = "GestureRecognizers/GestureRecognizers-Prefix.pch";
266+
"GCC_THUMB_SUPPORT[arch=armv7]" = YES;
260267
INFOPLIST_FILE = "GestureRecognizers/GestureRecognizers-Info.plist";
261268
IPHONEOS_DEPLOYMENT_TARGET = 3.2;
262269
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -269,6 +276,7 @@
269276
buildSettings = {
270277
GCC_PRECOMPILE_PREFIX_HEADER = YES;
271278
GCC_PREFIX_HEADER = "GestureRecognizers/GestureRecognizers-Prefix.pch";
279+
"GCC_THUMB_SUPPORT[arch=armv7]" = YES;
272280
INFOPLIST_FILE = "GestureRecognizers/GestureRecognizers-Info.plist";
273281
IPHONEOS_DEPLOYMENT_TARGET = 3.2;
274282
PRODUCT_NAME = "$(TARGET_NAME)";

GestureRecognizers/GestureRecognizers/ViewController.h

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,11 @@
99
#import <UIKit/UIKit.h>
1010

1111
@interface ViewController : UIViewController
12-
{
13-
UIView *allGesturesView; // 全てのジェスチャーを設定する
14-
UIView *panGestureView; // ドラッグジェスチャのみを設定する
15-
UIView *swipeGestureView; // スワイプジェスチャのみを設定する
16-
UILabel *showGestureName; // どのようなジェスチャを検知したかを出力する
17-
UILabel *showSubInfomation; // それに付随する情報を出力する
18-
}
1912

20-
@property (nonatomic, retain) IBOutlet UIView *allGesturesView;
21-
@property (nonatomic, retain) IBOutlet UIView *panGestureView;
22-
@property (nonatomic, retain) IBOutlet UIView *swipeGestureView;
23-
@property (nonatomic, retain) IBOutlet UILabel *showGestureName;
24-
@property (nonatomic, retain) IBOutlet UILabel *showSubInformation;
13+
@property (nonatomic, retain) IBOutlet UIView *allGesturesView; // 全てのジェスチャーを設定する
14+
@property (nonatomic, retain) IBOutlet UIView *panGestureView; // ドラッグジェスチャのみを設定する
15+
@property (nonatomic, retain) IBOutlet UIView *swipeGestureView; // スワイプジェスチャのみを設定する
16+
@property (nonatomic, retain) IBOutlet UILabel *gestureNameLabel; // 検出したジェスチャを出力する
17+
@property (nonatomic, retain) IBOutlet UILabel *subInformationLabel; // それに付随する情報を出力する
2518

2619
@end

GestureRecognizers/GestureRecognizers/ViewController.m

Lines changed: 55 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,29 @@ @interface ViewController ()
1414

1515
@implementation ViewController
1616

17-
@synthesize allGesturesView;
18-
@synthesize panGestureView;
19-
@synthesize swipeGestureView;
20-
@synthesize showGestureName;
21-
@synthesize showSubInformation;
17+
@synthesize allGesturesView = _allGesturesView;
18+
@synthesize panGestureView = _panGestureView;
19+
@synthesize swipeGestureView = _swipeGestureView;
20+
@synthesize gestureNameLabel = _gestureNameLabel;
21+
@synthesize subInformationLabel = _subInformationLabel;
2222

23-
- (void)loadView {
24-
[super loadView];
23+
- (void)viewDidLoad
24+
{
25+
[super viewDidLoad];
2526

2627
// 全てのジェスチャを設定
27-
[self addTagGestureRecognizer:allGesturesView];
28-
[self addPinchGestureRecognizer:allGesturesView];
29-
[self addPanGestureRecognizer:allGesturesView];
30-
[self addSwipeGestureRecognizer:allGesturesView];
31-
[self addRotationGestureRecognizer:allGesturesView];
32-
[self addLongPressGestureRecognizer:allGesturesView];
28+
[self addTagGestureRecognizer:_allGesturesView];
29+
[self addPinchGestureRecognizer:_allGesturesView];
30+
[self addPanGestureRecognizer:_allGesturesView];
31+
[self addSwipeGestureRecognizer:_allGesturesView];
32+
[self addRotationGestureRecognizer:_allGesturesView];
33+
[self addLongPressGestureRecognizer:_allGesturesView];
3334

3435
// スワイプと同じ動作なので、ドラッグジェスチャのみを設定
35-
[self addPanGestureRecognizer:panGestureView];
36+
[self addPanGestureRecognizer:_panGestureView];
3637

3738
// ドラッグと同じ動作なので、スワイプジェスチャのみを設定
38-
[self addSwipeGestureRecognizer:swipeGestureView];
39-
}
40-
41-
- (void)viewDidLoad
42-
{
43-
[super viewDidLoad];
44-
// Do any additional setup after loading the view, typically from a nib.
39+
[self addSwipeGestureRecognizer:_swipeGestureView];
4540
}
4641

4742
- (void)viewDidUnload
@@ -51,16 +46,17 @@ - (void)viewDidUnload
5146
self.allGesturesView = nil;
5247
self.panGestureView = nil;
5348
self.swipeGestureView = nil;
54-
self.showGestureName = nil;
55-
self.showSubInformation = nil;
49+
self.gestureNameLabel = nil;
50+
self.subInformationLabel = nil;
5651
}
5752

58-
- (void)dealloc {
59-
[allGesturesView release];
60-
[panGestureView release];
61-
[swipeGestureView release];
62-
[showGestureName release];
63-
[showSubInformation release];
53+
- (void)dealloc
54+
{
55+
[_allGesturesView release];
56+
[_panGestureView release];
57+
[_swipeGestureView release];
58+
[_gestureNameLabel release];
59+
[_subInformationLabel release];
6460

6561
[super dealloc];
6662
}
@@ -71,7 +67,7 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
7167
}
7268

7369
#pragma mark -
74-
#pragma mark add gestrue recognizer
70+
#pragma mark addGestrueRecognizers
7571

7672
- (void)addTagGestureRecognizer:(UIView *)view
7773
{
@@ -165,95 +161,95 @@ - (void)addLongPressGestureRecognizer:(UIView *)view
165161
}
166162

167163
#pragma mark -
168-
#pragma mark touch handler
164+
#pragma mark GestureRecognizer handlers
169165

170166
// 一本指でシングルタップ
171167
- (void)handleSingleFingerSingleTap:(UITapGestureRecognizer *)recognizer {
172-
[showGestureName setText:@"UITapGestureRecognizer"];
173-
[showSubInformation setText:@"[Single finger, Single tap]"];
168+
[self.gestureNameLabel setText:@"UITapGestureRecognizer"];
169+
[self.subInformationLabel setText:@"[Single finger, Single tap]"];
174170
}
175171

176172
// 一本指でダブルタップ
177173
- (void)handleSingleFingerDoubleTap:(UITapGestureRecognizer *)recognizer {
178-
[showGestureName setText:@"UITapGestureRecognizer"];
179-
[showSubInformation setText:@"[Single finger, Double tap]"];
174+
[self.gestureNameLabel setText:@"UITapGestureRecognizer"];
175+
[self.subInformationLabel setText:@"[Single finger, Double tap]"];
180176
}
181177

182178
// 二本指でシングルタップ
183179
- (void)handleTwoFingerSingleTap:(UITapGestureRecognizer *)recognizer {
184-
[showGestureName setText:@"UITapGestureRecognizer"];
185-
[showSubInformation setText:@"[Two finger, Single tap]"];
180+
[self.gestureNameLabel setText:@"UITapGestureRecognizer"];
181+
[self.subInformationLabel setText:@"[Two finger, Single tap]"];
186182
}
187183

188184
// 二本指でダブルタップ
189185
- (void)handleTwoFingerDoubleTap:(UITapGestureRecognizer *)recognizer {
190-
[showGestureName setText:@"UITapGestureRecognizer"];
191-
[showSubInformation setText:@"[Two finger, Double tap]"];
186+
[self.gestureNameLabel setText:@"UITapGestureRecognizer"];
187+
[self.subInformationLabel setText:@"[Two finger, Double tap]"];
192188
}
193189

194190
// ピンチイン・ピンチアウト
195191
- (void)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer {
196-
[showGestureName setText:@"UIPinchGestureRecognizer"];
197-
[showSubInformation setText:[NSString stringWithFormat:@"[scale:%f, velocity:%f]", recognizer.scale, recognizer.velocity]];
192+
[self.gestureNameLabel setText:@"UIPinchGestureRecognizer"];
193+
[self.subInformationLabel setText:[NSString stringWithFormat:@"[scale:%f, velocity:%f]", recognizer.scale, recognizer.velocity]];
198194
}
199195

200196
// ドラッグ
201197
- (void)handlePanGesture:(UIPanGestureRecognizer *)recognizer {
202-
[showGestureName setText:@"UIPanGestureRecognizer"];
198+
[self.gestureNameLabel setText:@"UIPanGestureRecognizer"];
203199
UIView *targetView = [recognizer view];
204200
CGPoint translationPoint = [recognizer translationInView:targetView];
205201
CGPoint velocityPoint = [recognizer velocityInView:targetView];
206-
[showSubInformation setText:[NSString stringWithFormat:@"[translation:(%f,%f), velocity:(%f,%f)]", translationPoint.x, translationPoint.y, velocityPoint.x, velocityPoint.y]];
202+
[self.subInformationLabel setText:[NSString stringWithFormat:@"[translation:(%f,%f), velocity:(%f,%f)]", translationPoint.x, translationPoint.y, velocityPoint.x, velocityPoint.y]];
207203
}
208204

209205
// スワイプ
210206
- (void)handleSwipeGesture:(UISwipeGestureRecognizer *)recognizer {
211-
[showGestureName setText:@"UISwipeGestureRecognizer"];
212-
NSString *directionName = nil;
207+
[self.gestureNameLabel setText:@"UISwipeGestureRecognizer"];
208+
NSString *directionString = nil;
213209
switch ([recognizer direction]) {
214210
case UISwipeGestureRecognizerDirectionRight:
215-
directionName = @"UISwipeGestureRecognizerDirectionRight";
211+
directionString = @"UISwipeGestureRecognizerDirectionRight";
216212
break;
217213
case UISwipeGestureRecognizerDirectionLeft:
218-
directionName = @"UISwipeGestureRecognizerDirectionLeft";
214+
directionString = @"UISwipeGestureRecognizerDirectionLeft";
219215
break;
220216
case UISwipeGestureRecognizerDirectionUp:
221-
directionName = @"UISwipeGestureRecognizerDirectionUp";
217+
directionString = @"UISwipeGestureRecognizerDirectionUp";
222218
break;
223219
case UISwipeGestureRecognizerDirectionDown:
224-
directionName = @"UISwipeGestureRecognizerDirectionDown";
220+
directionString = @"UISwipeGestureRecognizerDirectionDown";
225221
break;
226222
}
227-
[showSubInformation setText:[NSString stringWithFormat:@"[%@]", directionName]];
223+
[self.subInformationLabel setText:[NSString stringWithFormat:@"[%@]", directionString]];
228224
}
229225

230226
// 回転
231227
- (void)handleRotationGesture:(UIRotationGestureRecognizer *)recognizer {
232-
[showGestureName setText:@"UIRotationGestureRecognizer"];
233-
[showSubInformation setText:[NSString stringWithFormat:@"[rotation:%f, velocity:%f]", recognizer.rotation, recognizer.velocity]];
228+
[self.gestureNameLabel setText:@"UIRotationGestureRecognizer"];
229+
[self.subInformationLabel setText:[NSString stringWithFormat:@"[rotation:%f, velocity:%f]", recognizer.rotation, recognizer.velocity]];
234230
}
235231

236232
// 長押し
237233
- (void)handleLongPressGesture:(UILongPressGestureRecognizer *)recognizer {
238-
[showGestureName setText:@"UILongPressGestureRecognizer"];
239-
NSString *actionName = nil;
234+
[self.gestureNameLabel setText:@"UILongPressGestureRecognizer"];
235+
NSString *stateString = nil;
240236
switch ([recognizer state]) {
241237
case UIGestureRecognizerStateBegan:
242-
actionName = @"UIGestureRecognizerStateBegan";
238+
stateString = @"UIGestureRecognizerStateBegan";
243239
break;
244240
case UIGestureRecognizerStateChanged:
245-
actionName = @"UIGestureRecognizerStateChanged";
241+
stateString = @"UIGestureRecognizerStateChanged";
246242
break;
247243
case UIGestureRecognizerStateEnded:
248-
actionName = @"UIGestureRecognizerStateEnd";
244+
stateString = @"UIGestureRecognizerStateEnd";
249245
break;
250246
case UIGestureRecognizerStateCancelled:
251-
actionName = @"UIGestureRecognizerStateCancelled";
247+
stateString = @"UIGestureRecognizerStateCancelled";
252248
break;
253249
default:
254250
break;
255251
}
256-
[showSubInformation setText:[NSString stringWithFormat:@"[%@]", actionName]];
252+
[self.subInformationLabel setText:[NSString stringWithFormat:@"[%@]", stateString]];
257253
}
258254

259255
@end

0 commit comments

Comments
 (0)