Skip to content
This repository was archived by the owner on Jul 12, 2019. It is now read-only.

Commit 045ad9b

Browse files
committed
Updated README with new installation instructions
1 parent 4e6ae9c commit 045ad9b

1 file changed

Lines changed: 64 additions & 26 deletions

File tree

README.md

Lines changed: 64 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ MCSwipeTableViewCell
33

44
<p align="center"><img src="https://raw.github.com/alikaragoz/MCSwipeTableViewCell/master/github-assets/mcswipe-front.png"/></p>
55

6-
An Effort to show how one would implement a TableViewCell like the one we can see in the very well executed [Mailbox](http://www.mailboxapp.com/) iOS app.
6+
An Effort to show how one would implement a TableViewCell like the one we can see in the very well executed [Mailbox](http://www.mailboxapp.com/) iOS app.
77

88
##Demo
99
###Exit Mode
@@ -24,59 +24,59 @@ Please refer to the header file [`MCSwipeTableViewCell.h`](MCSwipeTableViewCell/
2424
```objc
2525
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
2626
static NSString *CellIdentifier = @"Cell";
27-
27+
2828
MCSwipeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
29-
29+
3030
if (!cell) {
3131
cell = [[MCSwipeTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
32-
32+
3333
// Remove inset of iOS 7 separators.
3434
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
3535
cell.separatorInset = UIEdgeInsetsZero;
3636
}
37-
37+
3838
[cell setSelectionStyle:UITableViewCellSelectionStyleGray];
3939

4040
// Setting the background color of the cell.
4141
cell.contentView.backgroundColor = [UIColor whiteColor];
4242
}
43-
43+
4444
// Configuring the views and colors.
4545
UIView *checkView = [self viewWithImageName:@"check"];
4646
UIColor *greenColor = [UIColor colorWithRed:85.0 / 255.0 green:213.0 / 255.0 blue:80.0 / 255.0 alpha:1.0];
47-
47+
4848
UIView *crossView = [self viewWithImageName:@"cross"];
4949
UIColor *redColor = [UIColor colorWithRed:232.0 / 255.0 green:61.0 / 255.0 blue:14.0 / 255.0 alpha:1.0];
50-
50+
5151
UIView *clockView = [self viewWithImageName:@"clock"];
5252
UIColor *yellowColor = [UIColor colorWithRed:254.0 / 255.0 green:217.0 / 255.0 blue:56.0 / 255.0 alpha:1.0];
53-
53+
5454
UIView *listView = [self viewWithImageName:@"list"];
5555
UIColor *brownColor = [UIColor colorWithRed:206.0 / 255.0 green:149.0 / 255.0 blue:98.0 / 255.0 alpha:1.0];
56-
56+
5757
// Setting the default inactive state color to the tableView background color.
5858
[cell setDefaultColor:self.tableView.backgroundView.backgroundColor];
59-
59+
6060
[cell.textLabel setText:@"Switch Mode Cell"];
6161
[cell.detailTextLabel setText:@"Swipe to switch"];
62-
62+
6363
// Adding gestures per state basis.
6464
[cell setSwipeGestureWithView:checkView color:greenColor mode:MCSwipeTableViewCellModeSwitch state:MCSwipeTableViewCellState1 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
6565
NSLog(@"Did swipe \"Checkmark\" cell");
6666
}];
67-
67+
6868
[cell setSwipeGestureWithView:crossView color:redColor mode:MCSwipeTableViewCellModeSwitch state:MCSwipeTableViewCellState2 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
6969
NSLog(@"Did swipe \"Cross\" cell");
7070
}];
71-
71+
7272
[cell setSwipeGestureWithView:clockView color:yellowColor mode:MCSwipeTableViewCellModeSwitch state:MCSwipeTableViewCellState3 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
7373
NSLog(@"Did swipe \"Clock\" cell");
7474
}];
75-
75+
7676
[cell setSwipeGestureWithView:listView color:brownColor mode:MCSwipeTableViewCellModeSwitch state:MCSwipeTableViewCellState4 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
7777
NSLog(@"Did swipe \"List\" cell");
7878
}];
79-
79+
8080
return cell;
8181
}
8282
```
@@ -108,9 +108,9 @@ In `MCSwipeTableViewCellModeExit` mode you may want to delete the cell with a ni
108108
```objc
109109
[cell setSwipeGestureWithView:crossView color:redColor mode:MCSwipeTableViewCellModeExit state:MCSwipeTableViewCellState2 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
110110
NSLog(@"Did swipe \"Cross\" cell");
111-
112-
// Code to delete your cell.
113-
[]
111+
112+
// Code to delete your cell...
113+
114114
}];
115115
```
116116
@@ -122,10 +122,10 @@ __weak MCTableViewController *weakSelf = self;
122122
123123
[cell setSwipeGestureWithView:crossView color:redColor mode:MCSwipeTableViewCellModeExit state:MCSwipeTableViewCellState1 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
124124
NSLog(@"Did swipe \"Cross\" cell");
125-
125+
126126
__strong MCTableViewController *strongSelf = weakSelf;
127127
strongSelf.cellToDelete = cell;
128-
128+
129129
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Delete?"
130130
message:@"Are you sure your want to delete the cell?"
131131
delegate:self
@@ -140,19 +140,18 @@ Then handle the `UIAlertView` action:
140140
#pragma mark - UIAlertViewDelegate
141141

142142
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
143-
143+
144144
// No
145145
if (buttonIndex == 0) {
146146
[_cellToDelete swipeToOriginWithCompletion:^{
147147
NSLog(@"Swiped back");
148148
}];
149149
_cellToDelete = nil;
150150
}
151-
151+
152152
// Yes
153153
else {
154-
// Code to delete your cell.
155-
[...]
154+
// Code to delete your cell...
156155
}
157156
}
158157
```
@@ -168,14 +167,53 @@ cell.secondTrigger = 0.5;
168167
```
169168

170169
###Reseting cell position
171-
It is possible to put the cell back to it's position when using the `MCSwipeTableViewCellModeExit` mode with the `-swipeToOriginWithCompletion:` method:
170+
It is possible to put the cell back to it's position when using the `MCSwipeTableViewCellModeExit` mode with the `-swipeToOriginWithCompletion:` method:
172171

173172
```objc
174173
[cell swipeToOriginWithCompletion:^{
175174
NSLog(@"Cell swiped back!");
176175
}];
177176
```
178177
178+
## Installation
179+
180+
### CocoaPods
181+
182+
[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects.
183+
184+
```bash
185+
$ gem install cocoapods
186+
```
187+
188+
To integrate MCSwipeTableViewCell into your Xcode project using CocoaPods, specify it in your `Podfile`:
189+
190+
```ruby
191+
pod 'MCSwipeTableViewCell', '~> 2.1.4'
192+
```
193+
194+
Then, run the following command:
195+
196+
```bash
197+
$ pod install
198+
```
199+
200+
### Carthage
201+
202+
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.
203+
204+
You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
205+
206+
```bash
207+
$ brew update
208+
$ brew install carthage
209+
```
210+
211+
To integrate MCSwipeTableViewCell into your Xcode project using Carthage, specify it in your `Cartfile`:
212+
213+
```ogdl
214+
github "alikaragoz/MCSwipeTableViewCell" >= 2.1.4
215+
```
216+
179217
##Compatibility
180218
This library is not compatible with auto-layout so you will need to disable auto-layout in your xib properties.
181219

0 commit comments

Comments
 (0)