levey / awesomemenu Goto Github PK
View Code? Open in Web Editor NEWPath 2.0 menu using CoreAnimation :)
Home Page: https://github.com/levey/AwesomeMenu
License: Other
Path 2.0 menu using CoreAnimation :)
Home Page: https://github.com/levey/AwesomeMenu
License: Other
I have a AwesomeMenu at the bottom of view, also has another UITextField.
When I touch on textfield, it shows a keyboard => I have to change AweSomeMenu's startPoint.
==> It changed Add button position, but the left items (which stored in menusArray) cant change their position.
So that, I extend your setStartPoint like this. Hope you can consider it for some cases like me.
- (void)setStartPoint:(CGPoint)aPoint
{
startPoint = aPoint;
_startButton.center = aPoint;
[self _setMenu];
}
I implemented Awesomemenu on TableView I customized.
Menu worked, but other View(includes TableView) didn't work.
Though I touch the window, never responded.
Here's the sample code. Let me know how to do.
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
UIImage *storyMenuItemImage = [UIImage imageNamed:@"bg-menuitem.png"];
UIImage *storyMenuItemImagePressed = [UIImage imageNamed:@"bg-menuitem-highlighted.png"];
UIImage *starImage = [UIImage imageNamed:@"icon-star.png"];
AwesomeMenuItem *starMenuItem1 = [[AwesomeMenuItem alloc] initWithImage:storyMenuItemImage
highlightedImage:storyMenuItemImagePressed
ContentImage:starImage
highlightedContentImage:nil];
AwesomeMenuItem *starMenuItem2 = [[AwesomeMenuItem alloc] initWithImage:storyMenuItemImage
highlightedImage:storyMenuItemImagePressed
ContentImage:starImage
highlightedContentImage:nil];
AwesomeMenuItem *starMenuItem3 = [[AwesomeMenuItem alloc] initWithImage:storyMenuItemImage
highlightedImage:storyMenuItemImagePressed
ContentImage:starImage
highlightedContentImage:nil];
NSArray *menus = [NSArray arrayWithObjects:starMenuItem1, starMenuItem2, starMenuItem3, nil];
[starMenuItem1 release];
[starMenuItem2 release];
[starMenuItem3 release];
AwesomeMenu *menu = [[AwesomeMenu alloc] initWithFrame:self.window.bounds menus:menus];
// customize menu
menu.startPoint = CGPointMake(30.0, 200.0);
menu.rotateAngle = M_PI/12;
menu.menuWholeAngle = M_PI/2;
menu.timeOffset = 0.1f;
menu.farRadius = 100.0f;
menu.endRadius = 100.0f;
menu.nearRadius = 50.0f;
menu.delegate = self;
[self.window addSubview:menu];
[menu release];
[self.window makeKeyAndVisible];
Assertion failed: (CGFloatIsValid(x) && CGFloatIsValid(y)), function void CGPathAddLineToPoint(CGMutablePathRef, const CGAffineTransform *, CGFloat, CGFloat), file Paths/CGPath.cc
"awesomeMenuWillAnimateClose" should only triggered when the menu will close;
It seems due to the transforms performed on the menuitems, they are resized or something which causes them to blur and look not so retina. This doesn't seem to be the case with the add button though.
Both the background of the menu items and their content images seem to be affected.
On the left is the result after the menu is opened. On the right is the original (menu item image + content image) http://cl.ly/FTpi
Here is also the same problem with the images you have supplied in the project http://cl.ly/FTEZ on left you see what happens when you run. and on the right is the original.
I want to do the effect like Path ,and how to add it to UITabbarController?
when I add it to UITabbarController,I can't add the gray background view to the key window correctly ,because when I use PushView Controller,the AwesomeMenu will not disappear.
Hi All,
I have two awesome menus side by side. They are providing selection services for two image widgets, and allow the user to select from camera or gallery for each image.
When I tap slowly or fast on a single Awesomemenu, it works fine.
When I wait for the animation on the first Awesome menu to complete, and then tap on the second, it's fine.
When I tap on the first menu, and then immediately tap on the second while the animation is going, I get a crash as shown below.
I'm a bit mystified...as far as I can tell, my code isn't really being touched here. I've tried returning during touches if the animation is still running...but...well...it doesn't seem to be touching my guards...just dying before I can trap it.
Any ideas?
-Ken
2016-04-23 16:08:55.476 CrowdLab[62630:48536049] -[**NSArrayI doubleValue]: unrecognized selector sent to instance 0x7ff04850d5d0
2016-04-23 16:09:04.303 CrowdLab[62630:48536049] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI doubleValue]: unrecognized selector sent to instance 0x7ff04850d5d0'
* First throw call stack:
(
0 CoreFoundation 0x000000010dcdbd85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010d2e5deb objc_exception_throw + 48
2 CoreFoundation 0x000000010dce4d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010dc2acfa __forwarding + 970
4 CoreFoundation 0x000000010dc2a8a8 _CF_forwarding_prep_0 + 120
5 QuartzCore 0x000000010b562b13 -[NSNumber(CAAnimatableValue) CA_interpolateValue:byFraction:] + 54
6 QuartzCore 0x000000010b55eed1 -[CABasicAnimation applyForTime:presentationObject:modelObject:] + 686
7 QuartzCore 0x000000010b562723 -[CAAnimationGroup applyForTime:presentationObject:modelObject:] + 195
8 QuartzCore 0x000000010b57cd4c _ZN2CA5Layer18presentation_layerEPNS_11TransactionE + 408
9 UIKit 0x000000010b8b7fb5 _UIViewEatsTouches + 107
10 UIKit 0x000000010b8b81c5 -[UIView(Geometry) hitTest:withEvent:] + 150
11 UIKit 0x000000010b8b86ff -[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:] + 85
12 UIKit 0x000000010b8b85c3 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 181
13 CoreFoundation 0x000000010dc03d32 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114
14 CoreFoundation 0x000000010dc034af -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 335
15 UIKit 0x000000010b8b831d -[UIView(Geometry) hitTest:withEvent:] + 494
16 UIKit 0x000000010b8b86ff -[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:] + 85
17 UIKit 0x000000010b8b85c3 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 181
18 CoreFoundation 0x000000010dc03d32 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114
19 CoreFoundation 0x000000010dc034af -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 335
20 UIKit 0x000000010b8b831d -[UIView(Geometry) hitTest:withEvent:] + 494
21 UIKit 0x000000010b8b86ff -[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:] + 85
22 UIKit 0x000000010b8b85c3 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 181
23 CoreFoundation 0x000000010dc03d32 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114
24 CoreFoundation 0x000000010dc034af -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 335
25 UIKit 0x000000010b8b831d -[UIView(Geometry) hitTest:withEvent:] + 494
26 UIKit 0x000000010b8b86ff -[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:] + 85
27 UIKit 0x000000010b8b85c3 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 181
28 CoreFoundation 0x000000010dc03d32 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114
29 CoreFoundation 0x000000010dc034af -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 335
30 UIKit 0x000000010b8b831d -[UIView(Geometry) hitTest:withEvent:] + 494
31 UIKit 0x000000010b8b86ff -[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:] + 85
32 UIKit 0x000000010b8b85c3 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 181
33 CoreFoundation 0x000000010dc03d32 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114
34 CoreFoundation 0x000000010dc034af -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 335
35 UIKit 0x000000010b8b831d -[UIView(Geometry) hitTest:withEvent:] + 494
36 UIKit 0x000000010b8b86ff -[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:] + 85
37 UIKit 0x000000010b8b85c3 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 181
38 CoreFoundation 0x000000010dc03d32 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114
39 CoreFoundation 0x000000010dc034af -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 335
40 UIKit 0x000000010b8b831d -[UIView(Geometry) hitTest:withEvent:] + 494
41 UIKit 0x000000010b97f436 -[UITransitionView hitTest:withEvent:] + 47
42 UIKit 0x000000010b8b86ff -[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:] + 85
43 UIKit 0x000000010b8b85c3 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 181
44 CoreFoundation 0x000000010dc03d32 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114
45 CoreFoundation 0x000000010dc034af -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 335
46 UIKit 0x000000010b8b831d -[UIView(Geometry) hitTest:withEvent:] + 494
47 UIKit 0x000000010b8b86ff -[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:] + 85
48 UIKit 0x000000010b89b11f __70+[UIWindow _hitTestToPoint:forEvent:windowServerHitTestWindow:screen:]_block_invoke + 247
49 UIKit 0x000000010b89ae9d +[UIWindow _topVisibleWindowPassingTest:] + 206
50 UIKit 0x000000010b89afde +[UIWindow _hitTestToPoint:forEvent:windowServerHitTestWindow:screen:] + 211
51 UIKit 0x000000010b89b337 -[UIWindow _targetWindowForPathIndex:atPoint:forEvent:windowServerHitTestWindow:onScreen:] + 200
52 UIKit 0x000000010b844d27 _UIApplicationHandleDigitizerEvent + 12802
53 UIKit 0x000000010b80edd9 _UIApplicationHandleEventQueue + 4746
54 CoreFoundation 0x000000010dc01301 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
55 CoreFoundation 0x000000010dbf722c __CFRunLoopDoSources0 + 556
56 CoreFoundation 0x000000010dbf66e3 __CFRunLoopRun + 867
57 CoreFoundation 0x000000010dbf60f8 CFRunLoopRunSpecific + 488
58 GraphicsServices 0x000000010f882ad2 GSEventRunModal + 161
59 UIKit 0x000000010b814f09 UIApplicationMain + 171
60 CrowdLab 0x0000000108e9baaf main + 111
61 libdyld.dylib 0x000000010e1d092d start + 1
First of all thanks for the great work. I was wondering if you are interested in a solution with which you can add AwesomeMenu to any UIControl?
I adapted a version of AwesomeMenu behave like that. You register the UIControl and AwesomeMenu gets magically added to it. I had such a use case in one of my projects, I would add a Pull Request if you're interested in this as well.
Cheers,
Georg
I just got AwesomeMenu via CocoaPods, and the - (id)initWithFrame:(CGRect)frame startItem:(AwesomeMenuItem*)startItem optionMenus:(NSArray *)aMenusArray; was changed to - (id)initWithFrame:(CGRect)frame menus:(NSArray *)aMenusArray;
why can't we customise the start button anymore?
I think this menu should not called "QuadCurveMenu" now, is "AwesomeMenu" better or fitter?
Hi Levey,
I changed your menu to use NSMutableArray instead of NSArray so I could add and remove items as necessary from within the AwesomeMenu.m.
This feature was needed for me as I need to change/add/remove menu icons when the user clicks on the AwesomeMenu's icons. I run an updateMenu function that I wrote when the closing animation of the menu finishes.
The updateMenu function looks like:
- (void) updateMenu
{
if (self.updateUI == TRUE)
{
[self.menusArray replaceObjectAtIndex:self.directlyAffects withObject: self.itemQueue];
[self.menusArray removeObjectAtIndex:self.indirectlyAffects];
self.updateUI = FALSE;
self.directlyAffects = 5;
self.indirectlyAffects = 5;
self.itemQueue = nil;
}
}
I have the items which I wish to add/remove stored into the self.directlyAffects and self.indirectlyAffects NSIntegers which I've added to the class. I've also cached in the item which I wish to add in the itemQueue. However, when I reopen the menu, the spacing between the icons is no longer uniform. Some icons are close together, others are far apart. It seems that I'm not calling some sort of update function in your menu or that this is not supported in anyway.
What can I do to get it to work?
Thanks!
it helps me a lot
I am trying to fade some labels to each menu item.
Each label should appear when I touch addButton to open menu items, and disappear when closed or selected.
It works with:
(void)AwesomeMenuDidFinishAnimationClose:(AwesomeMenu *)menu
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelay:0.0];
[UIView setAnimationDuration:1.0];
[label setAlpha:0];
[UIView commitAnimations];
NSLog(@"Menu was closed!");
}
(void)AwesomeMenuDidFinishAnimationOpen:(AwesomeMenu *)menu
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelay:0.0];
[UIView setAnimationDuration:1.0];
[label setAlpha:1];
[UIView commitAnimations];
NSLog(@"Menu is open!");
}
But is there how to startup my label fade in/out WITH (same time) menu animation?
It starts only when last menu animation item finish to move.
Thanx!
This would kill if you could have it on either side for Lefty or Righty
Hello this is very nice animation, but I tried to make the menu just like the one in the middle shown in the readme file. but failed I didn't got the correct co-ordinates
Could anyone let me know how to do it?
I'm working off master.
I don't get the delegate's awesomeMenu:didSelectIndex:
invoked when selecting a menu item. It gets called when selecting the start button.
I'm trying to debug this, but would be open to any ideas if someone else is having the same issue?
AwesomeMenuItem图片大小怎么调整,我放了一个尺寸大的图片,item就很大,放张小尺寸的图片,item就很小
2015-12-04 19:02:35.203 AwesomeMenu[26585:218332] *** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.29.5/UIApplication.m:3299
2015-12-04 19:02:35.255 AwesomeMenu[26585:218332] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
*** First throw call stack:
(
0 CoreFoundation 0x0239ea84 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01e5de02 objc_exception_throw + 50
2 CoreFoundation 0x0239e91a +[NSException raise:format:arguments:] + 138
3 Foundation 0x018d3e86 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 118
4 UIKit 0x00348a9b -[UIApplication _runWithMainScene:transitionContext:completion:] + 3975
5 UIKit 0x0036ce4d __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke3208 + 68
6 UIKit 0x00344fb4 -[UIApplication workspaceDidEndTransaction:] + 163
7 FrontBoardServices 0x061c8ca4 __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
8 FrontBoardServices 0x061c877b __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
9 FrontBoardServices 0x061e61a3 -[FBSSerialQueue _performNext] + 184
10 FrontBoardServices 0x061e65da -[FBSSerialQueue _performNextFromRunLoopSource] + 52
11 FrontBoardServices 0x061e58d6 FBSSerialQueueRunLoopSourceHandler + 33
12 CoreFoundation 0x022b8d1f CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 15
13 CoreFoundation 0x022ae9ab __CFRunLoopDoSources0 + 523
14 CoreFoundation 0x022addc8 __CFRunLoopRun + 1032
15 CoreFoundation 0x022ad706 CFRunLoopRunSpecific + 470
16 CoreFoundation 0x022ad51b CFRunLoopRunInMode + 123
17 UIKit 0x00344854 -[UIApplication _run] + 540
18 UIKit 0x0034a1eb UIApplicationMain + 160
19 AwesomeMenu 0x000606ba main + 138
20 libdyld.dylib 0x03b56a21 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I generally use the 3-clause BSD for everything myself, but it would be nice to know the terms under which others can use it. Right now it's just 100% owned by __MyCompanyName__
, which probably isn't your intention ;o)
I use Swift rewrote AwesomeMenu, [link here] (https://github.com/mythkiven/DiffuseMenu_Swift)
还请大神指教~
I have integrated Awesome menu code in my App now problem is that this menu shows in iOS simulator but not showing on iOS devices. Am I forgetting to configure something or anything else that I am missing?
If my menu items have a bigger image than the menu's main image then after the _close method runs, the menu items can be seen under the main menu.
I tried adding an opacity animation the animation group in _close, and I could see the menu items gradually fade out, but at the end of each animation the opacity is popping back to 1.0 and leaving them visible. Thought perhaps was the fillMode of the animation group, but its value seems correct.
Any idea how to solve this? for now I've added a loop on Animation end to set the alpha of the menu item images to 0.0, but its not as nice as them fading out during the main _close animation.
Can we use additional gesture (e.g. UILongPressGesture) instead of UITapGestureRecognizer for the "Add" image?
Also, can we implement this to a button instead of UIImage for the menus and "add" image too?
Hi,
The menu is definitely awesome. Thanks for the great work. I'm new to iOS so please forgive me if this request is stupid. I want to control the rotation of the Add button, how can I do this?
Thanks,
Looks great but position doesn't move for iPad applications.
cheers
Need a delegate call back when menuItems finishing animation close/expand. something look like
Got any pointers on how I could accomplish this with a UIDeviceOrientationDidChangeNotification?
I'd also like to be able to support both 'right' and 'left' thumbs, but that's easy with NSUserDefaults...
Any help greatly appreciated.
AwesomeMenu[15456:271322] *** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UIApplication.m:3401
2016-07-19 20:30:52.682 AwesomeMenu[15456:271322] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
How can I call expand function without clicking on the plus button?
Thank you!
Things I'd like if you're adding tests for this project
Tooling: KIF
Areas to look at:
Note
In anticipation of Test Jam
You need to remove the leading / in the source_files attribute of the podspec file.
It should be : spec.source_files = 'AwesomeMenu/AwesomeMenu/*'
instead of spec.source_files = '/AwesomeMenu/AwesomeMenu/*'
This causes the pod install to fail because the spec validation fails:
- ERROR | File Patterns: File patterns must be relative and cannot start with a slash (source_files).
How do you get it to work on a table view controller that has a scrolling table view? I understand that you need to make it a sibling of the parent view and yes you could use a view controller with a table view inside. But this is how I need to do it, so how are you supposed to make it work in a table view controller?
通过pod获取到得代码是旧版本的代码,请新开一个tag,命名为2.0。
There is no root view controller in your application delegate, so your demo crashed and I fixed it!
How can i add awesome defaultly expanded ,if user want close the menu
I’ve recently added AwesomeMenu to the CocoaPods package manager repo.
CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.
However, AwesomeMenu doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.
Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.
In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:
$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags
If press center button continuously while expanding animation is not finished, the animation will break and menu items will messup.
Should forbidden clicking while animation is not finished, just like what path behaviors.
Hi,
First of all, thanks for sharing the code.
It should be a silly question, but I can't change the add button position..
In using the menu.startPoint method, I think it will change the button position but it doesn't.
any help?
regards.
pull request created instead
I found a "QuadCurveMenu" instance in LICENSE.txt.
I think you may want to replace all "QuadCurveMenu" to "AwesomeMenu".
Love the menu.. Tried aslap dab ui -> ns brain transplant to no avail. Just piping in.. There is derrfinitely interest out there for this "control".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.