Skip to content

Commit e297147

Browse files
Merge pull request #28 from Yalantis/feature/es_updating_README
attempt to update README with nice layout
2 parents 3e847d0 + bf2798e commit e297147

File tree

1 file changed

+87
-54
lines changed

1 file changed

+87
-54
lines changed

README.md

Lines changed: 87 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,45 @@ Check this [project on dribbble] (https://dribbble.com/shots/1785274-Menu-Animat
88
Check this [project on Behance] (https://www.behance.net/gallery/20411445/Mobile-Animations-Interactions)
99

1010
![ContextMenu](https://d13yacurqjgara.cloudfront.net/users/125056/screenshots/1785274/99miles-profile-light_1-1-4.gif)
11+
<table>
12+
<tr>
13+
<td width="24.5%" valign="top" align="justify">
14+
<img src="https://github.com/Yalantis/Context-Menu.iOS/blob/master/Resources/TopLeft.png?raw=true">
15+
</td>
16+
<td width="0.5%">
17+
<div style="height:100%; width: 1px; background-color:white;"></div>
18+
</td>
19+
<td width="24.5%" valign="top" align="justify">
20+
<img src="https://github.com/Yalantis/Context-Menu.iOS/blob/master/Resources/BottomRight.png?raw=true">
21+
</td>
22+
<td width="0.5%">
23+
<div style="height:100%; width: 1px; background-color:white;"></div>
24+
</td>
25+
<td width="24.5%" valign="top" align="justify">
26+
<img src="https://github.com/Yalantis/Context-Menu.iOS/blob/master/Resources/BottomLeft.png?raw=true">
27+
</td>
28+
<td width="0.5%">
29+
<div style="height:100%; width: 1px; background-color:white;"></div>
30+
</td>
31+
<td width="24.5%" valign="top" align="justify">
32+
<img src="https://github.com/Yalantis/Context-Menu.iOS/blob/master/Resources/TopRight.png?raw=true">
33+
</td>
34+
</tr>
35+
</table>
1136

1237
####[CocoaPods](http://cocoapods.org)
1338
```ruby
14-
pod 'ContextMenu.iOS', '~> 1.0.0'
39+
pod 'ContextMenu.iOS', '~> 1.1.0'
1540
```
1641

1742
####Usage
1843

1944
You are welcome to see the sample of the project for fully operating sample in the Example folder.
2045

21-
* Add folder YALContextMenu to your project.
22-
* `#import “YALContextMenuTableView.h”` to your view controller
23-
* Create custom UITableViewCell with UIView property for rotation animation and UIView property for fade out animation.
24-
* Your custom cell should implement YALContextMenuCell protocol
46+
* Add folder YALContextMenu to your project.
47+
* `#import “YALContextMenuTableView.h”` to your view controller
48+
* Create custom UITableViewCell with UIView property for rotation animation and UIView property for fade out animation.
49+
* Your custom cell should implement YALContextMenuCell protocol
2550

2651
```objective-c
2752
@protocol YALContextMenuCell <NSObject>
@@ -32,84 +57,92 @@ You are welcome to see the sample of the project for fully operating sample in t
3257
@end
3358
```
3459
35-
* Use the following code sample to start menu
60+
* Use the following code sample to start menu
3661
3762
```objective-c
3863
- (IBAction)presentMenuButtonTapped:(UIBarButtonItem *)sender {
39-
// init YALContextMenuTableView tableView
40-
if (!self.contextMenuTableView) {
41-
self.contextMenuTableView = [[YALContextMenuTableView alloc]initWithTableViewDelegateDataSource:self];
42-
self.contextMenuTableView.animationDuration = 0.15;
43-
//optional - implement custom YALContextMenuTableView custom protocol
44-
self.contextMenuTableView.yalDelegate = self;
45-
46-
//register nib
47-
UINib *cellNib = [UINib nibWithNibName:@"ContextMenuCell" bundle:nil];
48-
[self.contextMenuTableView registerNib:cellNib forCellReuseIdentifier:@"contextMenuCellReuseId"];
49-
}
50-
51-
// it is better to use this method only for proper animation
52-
[self.contextMenuTableView showInView:self.navigationController.view withEdgeInsets:UIEdgeInsetsZero animated:YES];
64+
// init YALContextMenuTableView tableView
65+
if (!self.contextMenuTableView) {
66+
self.contextMenuTableView = [[YALContextMenuTableView alloc]initWithTableViewDelegateDataSource:self];
67+
self.contextMenuTableView.animationDuration = 0.15;
68+
//optional - implement custom YALContextMenuTableView custom protocol
69+
self.contextMenuTableView.yalDelegate = self;
70+
//optional - implement menu items layout
71+
self.contextMenuTableView.menuItemsSide = Right;
72+
self.contextMenuTableView.menuItemsAppearanceDirection = FromTopToBottom;
73+
74+
//register nib
75+
UINib *cellNib = [UINib nibWithNibName:@"ContextMenuCell" bundle:nil];
76+
[self.contextMenuTableView registerNib:cellNib forCellReuseIdentifier:@"contextMenuCellReuseId"];
77+
}
78+
79+
// it is better to use this method only for proper animation
80+
[self.contextMenuTableView showInView:self.navigationController.view withEdgeInsets:UIEdgeInsetsZero animated:YES];
5381
}
5482
```
5583

56-
* Use default UITableViewDataSource methods for additional set up and customisation of the cell.
57-
* Сall `updateAlongsideRotation` method before the rotation animation started and `reloadData` method after rotation animation finished or in UIViewControllerTransitionCoordinator's `animateAlongsideTransition` block for proper rotation animation.
58-
84+
* Use default UITableViewDataSource methods for additional set up and customisation of the cell.
85+
* Сall `updateAlongsideRotation` method before the rotation animation started and `reloadData` method after rotation animation finished or in UIViewControllerTransitionCoordinator's `animateAlongsideTransition` block for proper rotation animation.
86+
5987

6088
```objective-c
61-
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
62-
//should be called after rotation animation completed
63-
[self.contextMenuTableView reloadData];
89+
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
90+
//should be called after rotation animation completed
91+
[self.contextMenuTableView reloadData];
6492
}
6593

6694
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
67-
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
68-
69-
[self.contextMenuTableView updateAlongsideRotation];
95+
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
96+
97+
[self.contextMenuTableView updateAlongsideRotation];
7098
}
7199

72100
- (void)viewWillTransitionToSize:(CGSize)size
73-
withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
74-
75-
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
76-
77-
78-
[coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
79-
//should be called after rotation animation completed
80-
[self.contextMenuTableView reloadData];
81-
}];
82-
[self.contextMenuTableView updateAlongsideRotation];
83-
101+
withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
102+
103+
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
104+
105+
106+
[coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
107+
//should be called after rotation animation completed
108+
[self.contextMenuTableView reloadData];
109+
}];
110+
[self.contextMenuTableView updateAlongsideRotation];
111+
84112
}
85113
```
86-
114+
87115
### Customisation
88116

117+
To customise menu items side position you can specify a 'menuItemsSide' property. When it set to 'Right' the first cell will be opened from right to left and selected cell will be closed vice versa and when it set to 'Left' the first cell will be opened from left to right and selected cell will be closed vice versa. Default - Right.
118+
119+
Also, to customise menu items appearance direction you can specify 'menuItemsAppearanceDirection' property. Default - FromTopToBottom.
120+
89121
To customise cell set up your custom drawables in the animated icon. Actually the cell design and layout is completely at your choice.
90122

91123
animationDuration is to be used for animation speed in seconds.
92124

93125
### Compatibility
94126

95127
iOS 7,
96-
iOS 8
128+
iOS 8,
129+
iOS 9
97130

98-
#### Version: 1.0
131+
#### Version: 1.1.0
99132

100133
### License
101134

102-
Copyright 2015, Yalantis
135+
Copyright 2015, Yalantis
136+
137+
Licensed under the Apache License, Version 2.0 (the "License");
138+
you may not use this file except in compliance with the License.
139+
You may obtain a copy of the License at
103140

104-
Licensed under the Apache License, Version 2.0 (the "License");
105-
you may not use this file except in compliance with the License.
106-
You may obtain a copy of the License at
141+
http://www.apache.org/licenses/LICENSE-2.0
107142

108-
http://www.apache.org/licenses/LICENSE-2.0
143+
Unless required by applicable law or agreed to in writing, software
144+
distributed under the License is distributed on an "AS IS" BASIS,
145+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
146+
See the License for the specific language governing permissions and
147+
limitations under the License.
109148

110-
Unless required by applicable law or agreed to in writing, software
111-
distributed under the License is distributed on an "AS IS" BASIS,
112-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
113-
See the License for the specific language governing permissions and
114-
limitations under the License.
115-

0 commit comments

Comments
 (0)