motion-floating-action-button 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +54 -0
- data/lib/motion-floating-action-button/motion-floating-action-button.rb +18 -0
- data/lib/motion-floating-action-button.rb +12 -0
- data/vendor/motion-floating-action-button/VCFloatingActionButton.h +43 -0
- data/vendor/motion-floating-action-button/VCFloatingActionButton.m +365 -0
- data/vendor/motion-floating-action-button/build-iPhoneSimulator/VCFloatingActionButton.m.o +0 -0
- data/vendor/motion-floating-action-button/build-iPhoneSimulator/floatTableViewCell.m.o +0 -0
- data/vendor/motion-floating-action-button/build-iPhoneSimulator/libmotion-floating-action-button.a +0 -0
- data/vendor/motion-floating-action-button/build-iPhoneSimulator/motion-floating-action-button.pch +3 -0
- data/vendor/motion-floating-action-button/floatTableViewCell.h +17 -0
- data/vendor/motion-floating-action-button/floatTableViewCell.m +54 -0
- data/vendor/motion-floating-action-button/floatTableViewCell.xib +44 -0
- metadata +57 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f10a7364a21e88507be36da30afc0a2ff0699e87
|
4
|
+
data.tar.gz: 10d4dea6b3e04d68a6348fa00f5fcceae67079bc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 777f2821b5e6556a03cc3eeea6d983725e41ad6bdf90c06acf8f899fdfa52d89fafb7b75fdb7072e53fe53b398d278a82b23472a4dd46445286835989bd39687
|
7
|
+
data.tar.gz: 3a89107ed2055aeb65d4ffcc5702c4da95939a4f67710e9bd516803c4907410c248bc57d437efa30a07c46ca5f31494e5c38be25371019da077611d329af9c95
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
Motion-Swipe for RubyMotion
|
2
|
+
====================
|
3
|
+

|
4
|
+
|
5
|
+
Trying to add a Tinder-like swipe gem for RubyMotion. Not really production ready but useable. PRs for fixes, refactors and features accepted! This is also my first gem - advice/help is welcome.
|
6
|
+
|
7
|
+
This is a wrapper around Richard Kim's TinderSimpleSwipeCards written in obj-c. He does an excellent job detailing how it all works, so that you customize it easily. Some of that got erased when I was making this, so see his source: https://github.com/cwRichardKim/TinderSimpleSwipeCards
|
8
|
+
|
9
|
+
__create a draggable view background__
|
10
|
+
``` ruby
|
11
|
+
@draggable = MotionSwipe.build({
|
12
|
+
frame: CGRectMake(0, 0, self.view.frame.width, self.view.frame.height),
|
13
|
+
delegate: self # Needed if you want to call method of a class with your button
|
14
|
+
})
|
15
|
+
```
|
16
|
+
|
17
|
+
__adjust the draggable view's height and width__
|
18
|
+
``` ruby
|
19
|
+
@draggable.setCardWithHeight(@height, withWidth: width)
|
20
|
+
```
|
21
|
+
|
22
|
+
__create a new draggable view, and add it to the draggable view background__
|
23
|
+
``` ruby
|
24
|
+
new_card = @draggable.createDraggableView
|
25
|
+
@draggable.addCard(new_card)
|
26
|
+
```
|
27
|
+
|
28
|
+
__now just append views, buttons, or whatever to that draggable view__
|
29
|
+
``` ruby
|
30
|
+
# you can assign an id to the card for identification
|
31
|
+
new_card.cardId = card_id
|
32
|
+
```
|
33
|
+
|
34
|
+
__make sure to load the cards you added into the draggable view background__
|
35
|
+
``` ruby
|
36
|
+
# this method returns the number of cards
|
37
|
+
count = @draggable.loadCards()
|
38
|
+
```
|
39
|
+
|
40
|
+
__methods are available to swipe cards left or right without a gesture__
|
41
|
+
``` ruby
|
42
|
+
@draggable.swipeRight()
|
43
|
+
@draggable.swipeLeft()
|
44
|
+
```
|
45
|
+
|
46
|
+
__NSUserDefaults are used to track the current card, previously swiped card, and previous swipe direction__
|
47
|
+
```
|
48
|
+
@defaults = NSUserDefaults.standardUserDefaults
|
49
|
+
@defaults["cardCurrent"]
|
50
|
+
@defaults["cardSwiped"]
|
51
|
+
@defaults["cardSwipedDirection"]
|
52
|
+
```
|
53
|
+
|
54
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module MotionFloatingActionButton
|
2
|
+
|
3
|
+
module_function
|
4
|
+
|
5
|
+
def build(args)
|
6
|
+
|
7
|
+
@float_frame = args[:float_frame] || CGRectMake(0, 0, device.width, device.height)
|
8
|
+
# @normal = args[:normal]
|
9
|
+
|
10
|
+
addButton = VCFloatingActionButton.alloc.initWithFrame(@float_frame, normalImage: UIImage.imageNamed('icon-29'), andPressedImage: UIImage.imageNamed('icon-29'), withScrollview: UITableView.new)
|
11
|
+
|
12
|
+
# addButton = [[VCFloatingActionButton alloc]initWithFrame:floatFrame normalImage:[UIImage imageNamed:@"plus"] andPressedImage:[UIImage imageNamed:@"cross"] withScrollview:_dummyTable];
|
13
|
+
|
14
|
+
|
15
|
+
addButton
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
unless defined?(Motion::Project::Config)
|
2
|
+
raise "This file must be required within a RubyMotion project Rakefile."
|
3
|
+
end
|
4
|
+
|
5
|
+
Motion::Project::App.setup do |app|
|
6
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'motion-floating-action-button/*.rb')).each do |file|
|
7
|
+
app.files.unshift(file)
|
8
|
+
end
|
9
|
+
|
10
|
+
app.vendor_project(File.expand_path(File.join(File.dirname(__FILE__), '../vendor/motion-floating-action-button')), :static, cflags: "-fobjc-arc")
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
//
|
2
|
+
// VCFloatingActionButton.h
|
3
|
+
// starttrial
|
4
|
+
//
|
5
|
+
// Created by Giridhar on 25/03/15.
|
6
|
+
// Copyright (c) 2015 Giridhar. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <UIKit/UIKit.h>
|
10
|
+
|
11
|
+
@protocol floatMenuDelegate <NSObject>
|
12
|
+
|
13
|
+
@optional
|
14
|
+
-(void) didSelectMenuOptionAtIndex:(NSInteger)row;
|
15
|
+
@end
|
16
|
+
|
17
|
+
|
18
|
+
@interface VCFloatingActionButton : UIView <UITableViewDataSource,UITableViewDelegate,UIScrollViewDelegate>
|
19
|
+
|
20
|
+
@property NSArray *imageArray,*labelArray;
|
21
|
+
@property UITableView *menuTable;
|
22
|
+
@property UIView *buttonView;
|
23
|
+
@property id<floatMenuDelegate> delegate;
|
24
|
+
|
25
|
+
@property (nonatomic) BOOL hideWhileScrolling;
|
26
|
+
|
27
|
+
|
28
|
+
@property (strong,nonatomic) UIView *bgView;
|
29
|
+
@property (strong,nonatomic) UIScrollView *bgScroller;
|
30
|
+
@property (strong,nonatomic) UIImageView *normalImageView,*pressedImageView;
|
31
|
+
@property (strong,nonatomic) UIWindow *mainWindow;
|
32
|
+
@property (strong,nonatomic) UIImage *pressedImage, *normalImage;
|
33
|
+
@property (strong,nonatomic) NSDictionary *menuItemSet;
|
34
|
+
|
35
|
+
|
36
|
+
@property BOOL isMenuVisible;
|
37
|
+
@property UIView *windowView;
|
38
|
+
|
39
|
+
-(id)initWithFrame:(CGRect)frame normalImage:(UIImage*)passiveImage andPressedImage:(UIImage*)activeImage withScrollview:(UIScrollView*)scrView;
|
40
|
+
//-(void) setupButton;
|
41
|
+
|
42
|
+
|
43
|
+
@end
|
@@ -0,0 +1,365 @@
|
|
1
|
+
//
|
2
|
+
// VCFloatingActionButton.m
|
3
|
+
// starttrial
|
4
|
+
//
|
5
|
+
// Created by Giridhar on 25/03/15.
|
6
|
+
// Copyright (c) 2015 Giridhar. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "VCFloatingActionButton.h"
|
10
|
+
#import "floatTableViewCell.h"
|
11
|
+
|
12
|
+
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
|
13
|
+
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
|
14
|
+
|
15
|
+
CGFloat animationTime = 0.55;
|
16
|
+
CGFloat rowHeight = 60.f;
|
17
|
+
NSInteger noOfRows = 0;
|
18
|
+
NSInteger tappedRow;
|
19
|
+
CGFloat previousOffset;
|
20
|
+
CGFloat buttonToScreenHeight;
|
21
|
+
@implementation VCFloatingActionButton
|
22
|
+
|
23
|
+
@synthesize windowView;
|
24
|
+
//@synthesize hideWhileScrolling;
|
25
|
+
@synthesize delegate;
|
26
|
+
|
27
|
+
@synthesize bgScroller;
|
28
|
+
|
29
|
+
-(id)initWithFrame:(CGRect)frame normalImage:(UIImage*)passiveImage andPressedImage:(UIImage*)activeImage withScrollview:(UIScrollView*)scrView
|
30
|
+
{
|
31
|
+
self = [super initWithFrame:frame];
|
32
|
+
if (self)
|
33
|
+
{
|
34
|
+
windowView = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
|
35
|
+
_mainWindow = [UIApplication sharedApplication].keyWindow;
|
36
|
+
_buttonView = [[UIView alloc]initWithFrame:frame];
|
37
|
+
_buttonView.backgroundColor = [UIColor clearColor];
|
38
|
+
_buttonView.userInteractionEnabled = YES;
|
39
|
+
|
40
|
+
buttonToScreenHeight = SCREEN_HEIGHT - CGRectGetMaxY(self.frame);
|
41
|
+
|
42
|
+
_menuTable = [[UITableView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/4, 0, 0.75*SCREEN_WIDTH,SCREEN_HEIGHT - (SCREEN_HEIGHT - CGRectGetMaxY(self.frame)) )];
|
43
|
+
_menuTable.scrollEnabled = NO;
|
44
|
+
|
45
|
+
|
46
|
+
_menuTable.tableHeaderView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/2, CGRectGetHeight(frame))];
|
47
|
+
|
48
|
+
_menuTable.delegate = self;
|
49
|
+
_menuTable.dataSource = self;
|
50
|
+
_menuTable.separatorStyle = UITableViewCellSeparatorStyleNone;
|
51
|
+
_menuTable.backgroundColor = [UIColor clearColor];
|
52
|
+
_menuTable.transform = CGAffineTransformMakeRotation(-M_PI); //Rotate the table
|
53
|
+
|
54
|
+
previousOffset = scrView.contentOffset.y;
|
55
|
+
|
56
|
+
bgScroller = scrView;
|
57
|
+
|
58
|
+
_pressedImage = activeImage;
|
59
|
+
_normalImage = passiveImage;
|
60
|
+
[self setupButton];
|
61
|
+
|
62
|
+
}
|
63
|
+
return self;
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
-(void)setHideWhileScrolling:(BOOL)hideWhileScrolling
|
68
|
+
{
|
69
|
+
if (bgScroller!=nil)
|
70
|
+
{
|
71
|
+
_hideWhileScrolling = hideWhileScrolling;
|
72
|
+
if (hideWhileScrolling)
|
73
|
+
{
|
74
|
+
[bgScroller addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew context:nil];
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
-(void) setupButton
|
82
|
+
{
|
83
|
+
_isMenuVisible = false;
|
84
|
+
self.backgroundColor = [UIColor clearColor];
|
85
|
+
UITapGestureRecognizer *buttonTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTap:)];
|
86
|
+
[self addGestureRecognizer:buttonTap];
|
87
|
+
|
88
|
+
|
89
|
+
UITapGestureRecognizer *buttonTap3 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTap:)];
|
90
|
+
|
91
|
+
[_buttonView addGestureRecognizer:buttonTap3];
|
92
|
+
|
93
|
+
|
94
|
+
UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
95
|
+
UIVisualEffectView *vsview = [[UIVisualEffectView alloc]initWithEffect:blur];
|
96
|
+
|
97
|
+
|
98
|
+
_bgView = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
|
99
|
+
_bgView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.8];
|
100
|
+
_bgView.alpha = 0;
|
101
|
+
_bgView.userInteractionEnabled = YES;
|
102
|
+
UITapGestureRecognizer *buttonTap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTap:)];
|
103
|
+
|
104
|
+
buttonTap2.cancelsTouchesInView = NO;
|
105
|
+
vsview.frame = _bgView.bounds;
|
106
|
+
_bgView = vsview;
|
107
|
+
[_bgView addGestureRecognizer:buttonTap2];
|
108
|
+
|
109
|
+
|
110
|
+
_normalImageView = [[UIImageView alloc]initWithFrame:self.bounds];
|
111
|
+
_normalImageView.userInteractionEnabled = YES;
|
112
|
+
_normalImageView.contentMode = UIViewContentModeScaleAspectFit;
|
113
|
+
_normalImageView.layer.shadowColor = [UIColor blackColor].CGColor;
|
114
|
+
_normalImageView.layer.shadowRadius = 5.f;
|
115
|
+
_normalImageView.layer.shadowOffset = CGSizeMake(-10, -10);
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
_pressedImageView = [[UIImageView alloc]initWithFrame:self.bounds];
|
120
|
+
_pressedImageView.contentMode = UIViewContentModeScaleAspectFit;
|
121
|
+
_pressedImageView.userInteractionEnabled = YES;
|
122
|
+
|
123
|
+
|
124
|
+
_normalImageView.image = _normalImage;
|
125
|
+
_pressedImageView.image = _pressedImage;
|
126
|
+
|
127
|
+
|
128
|
+
[_bgView addSubview:_menuTable];
|
129
|
+
|
130
|
+
[_buttonView addSubview:_pressedImageView];
|
131
|
+
[_buttonView addSubview:_normalImageView];
|
132
|
+
[self addSubview:_normalImageView];
|
133
|
+
|
134
|
+
}
|
135
|
+
|
136
|
+
-(void)handleTap:(id)sender //Show Menu
|
137
|
+
{
|
138
|
+
|
139
|
+
|
140
|
+
if (_isMenuVisible)
|
141
|
+
{
|
142
|
+
|
143
|
+
[self dismissMenu:nil];
|
144
|
+
}
|
145
|
+
else
|
146
|
+
{
|
147
|
+
[windowView addSubview:_bgView];
|
148
|
+
[windowView addSubview:_buttonView];
|
149
|
+
|
150
|
+
[_mainWindow addSubview:windowView];
|
151
|
+
[self showMenu:nil];
|
152
|
+
}
|
153
|
+
_isMenuVisible = !_isMenuVisible;
|
154
|
+
|
155
|
+
|
156
|
+
}
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
#pragma mark -- Animations
|
162
|
+
#pragma mark ---- button tap Animations
|
163
|
+
|
164
|
+
-(void) showMenu:(id)sender
|
165
|
+
{
|
166
|
+
|
167
|
+
self.pressedImageView.transform = CGAffineTransformMakeRotation(M_PI);
|
168
|
+
self.pressedImageView.alpha = 0.0; //0.3
|
169
|
+
[UIView animateWithDuration:animationTime/2 animations:^
|
170
|
+
{
|
171
|
+
self.bgView.alpha = 1;
|
172
|
+
|
173
|
+
|
174
|
+
self.normalImageView.transform = CGAffineTransformMakeRotation(-M_PI);
|
175
|
+
self.normalImageView.alpha = 0.0; //0.7
|
176
|
+
|
177
|
+
|
178
|
+
self.pressedImageView.transform = CGAffineTransformIdentity;
|
179
|
+
self.pressedImageView.alpha = 1;
|
180
|
+
noOfRows = _labelArray.count;
|
181
|
+
[_menuTable reloadData];
|
182
|
+
|
183
|
+
}
|
184
|
+
completion:^(BOOL finished)
|
185
|
+
{
|
186
|
+
}];
|
187
|
+
|
188
|
+
}
|
189
|
+
|
190
|
+
-(void) dismissMenu:(id) sender
|
191
|
+
|
192
|
+
{
|
193
|
+
[UIView animateWithDuration:animationTime/2 animations:^
|
194
|
+
{
|
195
|
+
self.bgView.alpha = 0;
|
196
|
+
self.pressedImageView.alpha = 0.f;
|
197
|
+
self.pressedImageView.transform = CGAffineTransformMakeRotation(-M_PI);
|
198
|
+
self.normalImageView.transform = CGAffineTransformMakeRotation(0);
|
199
|
+
self.normalImageView.alpha = 1.f;
|
200
|
+
} completion:^(BOOL finished)
|
201
|
+
{
|
202
|
+
noOfRows = 0;
|
203
|
+
[_bgView removeFromSuperview];
|
204
|
+
[windowView removeFromSuperview];
|
205
|
+
[_mainWindow removeFromSuperview];
|
206
|
+
|
207
|
+
}];
|
208
|
+
}
|
209
|
+
|
210
|
+
#pragma mark ---- Scroll animations
|
211
|
+
|
212
|
+
-(void) showMenuDuringScroll:(BOOL) shouldShow
|
213
|
+
{
|
214
|
+
if (_hideWhileScrolling)
|
215
|
+
{
|
216
|
+
|
217
|
+
if (!shouldShow)
|
218
|
+
{
|
219
|
+
[UIView animateWithDuration:animationTime animations:^
|
220
|
+
{
|
221
|
+
self.transform = CGAffineTransformMakeTranslation(0, buttonToScreenHeight*6);
|
222
|
+
} completion:nil];
|
223
|
+
}
|
224
|
+
else
|
225
|
+
{
|
226
|
+
[UIView animateWithDuration:animationTime/2 animations:^
|
227
|
+
{
|
228
|
+
self.transform = CGAffineTransformIdentity;
|
229
|
+
} completion:nil];
|
230
|
+
}
|
231
|
+
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
|
236
|
+
-(void) addRows
|
237
|
+
{
|
238
|
+
NSMutableArray *ip = [[NSMutableArray alloc]init];
|
239
|
+
for (int i = 0; i< noOfRows; i++)
|
240
|
+
{
|
241
|
+
[ip addObject:[NSIndexPath indexPathForRow:i inSection:0]];
|
242
|
+
}
|
243
|
+
[_menuTable insertRowsAtIndexPaths:ip withRowAnimation:UITableViewRowAnimationFade];
|
244
|
+
}
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
#pragma mark -- Observer for scrolling
|
250
|
+
-(void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
251
|
+
{
|
252
|
+
if ([keyPath isEqualToString:@"contentOffset"])
|
253
|
+
{
|
254
|
+
|
255
|
+
NSLog(@"%f",bgScroller.contentOffset.y);
|
256
|
+
|
257
|
+
CGFloat diff = previousOffset - bgScroller.contentOffset.y;
|
258
|
+
|
259
|
+
if (ABS(diff) > 15)
|
260
|
+
{
|
261
|
+
if (bgScroller.contentOffset.y > 0)
|
262
|
+
{
|
263
|
+
[self showMenuDuringScroll:(previousOffset > bgScroller.contentOffset.y)];
|
264
|
+
previousOffset = bgScroller.contentOffset.y;
|
265
|
+
}
|
266
|
+
else
|
267
|
+
{
|
268
|
+
[self showMenuDuringScroll:YES];
|
269
|
+
}
|
270
|
+
|
271
|
+
|
272
|
+
}
|
273
|
+
|
274
|
+
}
|
275
|
+
}
|
276
|
+
|
277
|
+
|
278
|
+
#pragma mark -- Tableview methods
|
279
|
+
|
280
|
+
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
281
|
+
{
|
282
|
+
return 1;
|
283
|
+
}
|
284
|
+
|
285
|
+
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
286
|
+
{
|
287
|
+
return noOfRows;
|
288
|
+
}
|
289
|
+
|
290
|
+
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
291
|
+
{
|
292
|
+
return rowHeight;
|
293
|
+
}
|
294
|
+
|
295
|
+
|
296
|
+
-(void)tableView:(UITableView *)tableView willDisplayCell:(floatTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
|
297
|
+
{
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
//KeyFrame animation
|
303
|
+
|
304
|
+
// CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"position.y"];
|
305
|
+
// anim.fromValue = @((indexPath.row+1)*CGRectGetHeight(cell.imgView.frame)*-1);
|
306
|
+
// anim.toValue = @(cell.frame.origin.y);
|
307
|
+
// anim.duration = animationTime/2;
|
308
|
+
// anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
309
|
+
// [cell.layer addAnimation:anim forKey:@"position.y"];
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
double delay = (indexPath.row*indexPath.row) * 0.004; //Quadratic time function for progressive delay
|
315
|
+
|
316
|
+
|
317
|
+
CGAffineTransform scaleTransform = CGAffineTransformMakeScale(0.95, 0.95);
|
318
|
+
CGAffineTransform translationTransform = CGAffineTransformMakeTranslation(0,-(indexPath.row+1)*CGRectGetHeight(cell.imgView.frame));
|
319
|
+
cell.transform = CGAffineTransformConcat(scaleTransform, translationTransform);
|
320
|
+
cell.alpha = 0.f;
|
321
|
+
|
322
|
+
[UIView animateWithDuration:animationTime/2 delay:delay options:UIViewAnimationOptionCurveEaseOut animations:^
|
323
|
+
{
|
324
|
+
|
325
|
+
cell.transform = CGAffineTransformIdentity;
|
326
|
+
cell.alpha = 1.f;
|
327
|
+
|
328
|
+
} completion:^(BOOL finished)
|
329
|
+
{
|
330
|
+
|
331
|
+
}];
|
332
|
+
|
333
|
+
}
|
334
|
+
|
335
|
+
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
336
|
+
{
|
337
|
+
NSString *identifier = @"cell";
|
338
|
+
floatTableViewCell *cell = [_menuTable dequeueReusableCellWithIdentifier:identifier];
|
339
|
+
if (!cell)
|
340
|
+
{
|
341
|
+
[_menuTable registerNib:[UINib nibWithNibName:@"floatTableViewCell" bundle:nil]forCellReuseIdentifier:identifier];
|
342
|
+
cell = [_menuTable dequeueReusableCellWithIdentifier:identifier];
|
343
|
+
}
|
344
|
+
|
345
|
+
// NSLog(@"%@",[_menuItemSet allKeys]);
|
346
|
+
// NSLog(@"%@",[_menuItemSet allValues]);
|
347
|
+
|
348
|
+
// cell.imgView.image = [UIImage imageNamed:[[_menuItemSet allKeys]objectAtIndex:indexPath.row]];
|
349
|
+
// cell.title.text = [[_menuItemSet allValues]objectAtIndex:indexPath.row];
|
350
|
+
|
351
|
+
cell.imgView.image = [UIImage imageNamed:[_imageArray objectAtIndex:indexPath.row]];
|
352
|
+
cell.title.text = [_labelArray objectAtIndex:indexPath.row];
|
353
|
+
|
354
|
+
|
355
|
+
return cell;
|
356
|
+
}
|
357
|
+
|
358
|
+
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
359
|
+
{
|
360
|
+
// NSLog(@"selected CEll: %tu",indexPath.row);
|
361
|
+
[delegate didSelectMenuOptionAtIndex:indexPath.row];
|
362
|
+
|
363
|
+
}
|
364
|
+
|
365
|
+
@end
|
Binary file
|
Binary file
|
data/vendor/motion-floating-action-button/build-iPhoneSimulator/libmotion-floating-action-button.a
ADDED
Binary file
|
@@ -0,0 +1,17 @@
|
|
1
|
+
//
|
2
|
+
// floatTableViewCell.h
|
3
|
+
// floatingButtonTrial
|
4
|
+
//
|
5
|
+
// Created by Giridhar on 26/03/15.
|
6
|
+
// Copyright (c) 2015 Giridhar. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <UIKit/UIKit.h>
|
10
|
+
|
11
|
+
@interface floatTableViewCell : UITableViewCell
|
12
|
+
@property (weak, nonatomic) IBOutlet UIImageView *imgView;
|
13
|
+
@property (weak, nonatomic) IBOutlet UILabel *title;
|
14
|
+
@property (strong,nonatomic) UIView *overlay;
|
15
|
+
-(void)setTitle:(NSString*)txt andImage:(UIImage*)img;
|
16
|
+
|
17
|
+
@end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
//
|
2
|
+
// floatTableViewCell.m
|
3
|
+
// floatingButtonTrial
|
4
|
+
//
|
5
|
+
// Created by Giridhar on 26/03/15.
|
6
|
+
// Copyright (c) 2015 Giridhar. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "floatTableViewCell.h"
|
10
|
+
|
11
|
+
@implementation floatTableViewCell
|
12
|
+
@synthesize imgView, title,overlay;
|
13
|
+
|
14
|
+
- (void)awakeFromNib
|
15
|
+
{
|
16
|
+
// Initialization code
|
17
|
+
overlay = [UIView new];
|
18
|
+
overlay.backgroundColor = [UIColor colorWithWhite:0.8 alpha:0.6];
|
19
|
+
[title addSubview:overlay];
|
20
|
+
self.imgView.layer.cornerRadius = 45/2;
|
21
|
+
self.imgView.layer.masksToBounds = YES;
|
22
|
+
// self.title.backgroundColor = [UIColor colorWithWhite:0.8 alpha:0.8];
|
23
|
+
// self.title.layer.cornerRadius = 5.f;
|
24
|
+
// self.title.layer.masksToBounds = YES;
|
25
|
+
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
26
|
+
self.backgroundColor = [UIColor clearColor];
|
27
|
+
self.contentView.transform = CGAffineTransformMakeRotation(-M_PI);
|
28
|
+
}
|
29
|
+
|
30
|
+
|
31
|
+
-(void)setTitle:(NSString*)txt andImage:(UIImage*)img
|
32
|
+
{
|
33
|
+
// self.title.text = txt;
|
34
|
+
//
|
35
|
+
// CGFloat width = ceil([self.title.text sizeWithAttributes:@{NSFontAttributeName: self.title.font}].width);
|
36
|
+
//
|
37
|
+
// CGFloat height = ceil([self.title.text sizeWithAttributes:@{NSFontAttributeName: self.title.font}].height);
|
38
|
+
//
|
39
|
+
// overlay.frame = CGRectMake(CGRectGetMaxX(self.title.frame), CGRectGetMaxY(self.title.frame), width, height);
|
40
|
+
//
|
41
|
+
//
|
42
|
+
//
|
43
|
+
// self.imgView.image = img;
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
|
48
|
+
{
|
49
|
+
[super setSelected:selected animated:animated];
|
50
|
+
|
51
|
+
// Configure the view for the selected state
|
52
|
+
}
|
53
|
+
|
54
|
+
@end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6751" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
3
|
+
<dependencies>
|
4
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
|
5
|
+
</dependencies>
|
6
|
+
<objects>
|
7
|
+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
8
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
9
|
+
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="floatTableViewCell">
|
10
|
+
<rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
|
11
|
+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
12
|
+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
13
|
+
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
14
|
+
<autoresizingMask key="autoresizingMask"/>
|
15
|
+
<subviews>
|
16
|
+
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="sVt-ta-6Yu">
|
17
|
+
<rect key="frame" x="257" y="2" width="45" height="45"/>
|
18
|
+
<constraints>
|
19
|
+
<constraint firstAttribute="width" constant="45" id="P93-3K-N9f"/>
|
20
|
+
<constraint firstAttribute="height" constant="45" id="mqc-fm-Jug"/>
|
21
|
+
</constraints>
|
22
|
+
</imageView>
|
23
|
+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xke-gv-IoN">
|
24
|
+
<rect key="frame" x="207" y="14" width="42" height="21"/>
|
25
|
+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
26
|
+
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
27
|
+
<nil key="highlightedColor"/>
|
28
|
+
</label>
|
29
|
+
</subviews>
|
30
|
+
<constraints>
|
31
|
+
<constraint firstItem="sVt-ta-6Yu" firstAttribute="leading" secondItem="xke-gv-IoN" secondAttribute="trailing" constant="8" id="8oZ-iZ-2N8"/>
|
32
|
+
<constraint firstAttribute="centerY" secondItem="sVt-ta-6Yu" secondAttribute="centerY" id="by5-zg-Brf"/>
|
33
|
+
<constraint firstAttribute="trailing" secondItem="sVt-ta-6Yu" secondAttribute="trailing" constant="18" id="dT4-nx-suN"/>
|
34
|
+
<constraint firstAttribute="centerY" secondItem="xke-gv-IoN" secondAttribute="centerY" id="sLm-na-xP7"/>
|
35
|
+
</constraints>
|
36
|
+
</tableViewCellContentView>
|
37
|
+
<connections>
|
38
|
+
<outlet property="imgView" destination="sVt-ta-6Yu" id="lEW-XZ-35G"/>
|
39
|
+
<outlet property="title" destination="xke-gv-IoN" id="t8w-Dn-E1j"/>
|
40
|
+
</connections>
|
41
|
+
<point key="canvasLocation" x="413" y="366"/>
|
42
|
+
</tableViewCell>
|
43
|
+
</objects>
|
44
|
+
</document>
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: motion-floating-action-button
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Damien Sutevski
|
8
|
+
- Siyuan Liu
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-11-26 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Easily create an interface with swipeable cards.
|
15
|
+
email: dameyawn@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- README.md
|
21
|
+
- lib/motion-floating-action-button.rb
|
22
|
+
- lib/motion-floating-action-button/motion-floating-action-button.rb
|
23
|
+
- vendor/motion-floating-action-button/VCFloatingActionButton.h
|
24
|
+
- vendor/motion-floating-action-button/VCFloatingActionButton.m
|
25
|
+
- vendor/motion-floating-action-button/build-iPhoneSimulator/VCFloatingActionButton.m.o
|
26
|
+
- vendor/motion-floating-action-button/build-iPhoneSimulator/floatTableViewCell.m.o
|
27
|
+
- vendor/motion-floating-action-button/build-iPhoneSimulator/libmotion-floating-action-button.a
|
28
|
+
- vendor/motion-floating-action-button/build-iPhoneSimulator/motion-floating-action-button.pch
|
29
|
+
- vendor/motion-floating-action-button/floatTableViewCell.h
|
30
|
+
- vendor/motion-floating-action-button/floatTableViewCell.m
|
31
|
+
- vendor/motion-floating-action-button/floatTableViewCell.xib
|
32
|
+
homepage: http://github.com/dam13n/motion-floating-action-button
|
33
|
+
licenses:
|
34
|
+
- MIT
|
35
|
+
metadata: {}
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
- vendor
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 2.2.2
|
54
|
+
signing_key:
|
55
|
+
specification_version: 4
|
56
|
+
summary: Rubymotion gem to use TinderSimpleSwipeCards
|
57
|
+
test_files: []
|