├── Pop-upMenu ├── Assets.xcassets │ ├── Contents.json │ ├── ListGPS.imageset │ │ ├── @2_08.png │ │ ├── 未标题-1_08.png │ │ └── Contents.json │ ├── ListRFID.imageset │ │ ├── 未标题-6_33.png │ │ ├── 未标题-6_34.png │ │ └── Contents.json │ ├── ListMonitor.imageset │ │ ├── 未标题-6_41.png │ │ ├── 未标题-6_42.png │ │ └── Contents.json │ ├── ListInspection.imageset │ │ ├── 未标题-6_42.png │ │ ├── 未标题-6_43.png │ │ └── Contents.json │ ├── ListWaterLevel.imageset │ │ ├── 未标题-6_48.png │ │ ├── 未标题-6_49.png │ │ └── Contents.json │ ├── ListInspection-1.imageset │ │ ├── 未标题-6_42.png │ │ ├── 未标题-6_43.png │ │ └── Contents.json │ ├── ListWaterQuality.imageset │ │ ├── 未标题-6_50.png │ │ ├── 未标题-6_51.png │ │ └── Contents.json │ ├── ListInspectionPath.imageset │ │ ├── 未标题-6_36.png │ │ ├── 未标题-6_37.png │ │ └── Contents.json │ ├── tabbar0_n.imageset │ │ ├── nav_button_home_default@2x.png │ │ ├── nav_button_home_default@3x.png │ │ └── Contents.json │ ├── tabbar0_s.imageset │ │ ├── nav_button_home_selected@2x.png │ │ ├── nav_button_home_selected@3x.png │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── Test │ ├── TestViewController.h │ ├── TestTabBarController.h │ ├── TestTableViewController.h │ ├── TestArrowheadMenuSelectedStateViewController.h │ ├── TestTableViewController.m │ ├── TestTabBarController.m │ ├── TestArrowheadMenuSelectedStateViewController.m │ └── TestViewController.m ├── AppDelegate.h ├── main.m ├── XYMenu │ ├── CenterMenu.h │ ├── UIView+DrawGraphics.h │ ├── BaseMenuViewController.m │ ├── BaseMenuViewController.h │ ├── ArrowheadMenu.h │ ├── ArrowheadMenuSelectedState.h │ ├── CenterMenu.m │ ├── ArrowheadMenu.m │ ├── UIView+DrawGraphics.m │ └── ArrowheadMenuSelectedState.m ├── Info.plist ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.storyboard └── AppDelegate.m ├── DisplayResources ├── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.15.png ├── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.22.png ├── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.27.png ├── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.29.png ├── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.32.png ├── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.35.png ├── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.37.png ├── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.39.png ├── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.42.png ├── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.45.png ├── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.48.png ├── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.57.00.png └── Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.57.08.png ├── Pop-upMenu.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── project.pbxproj ├── Pop-upMenuTests ├── Info.plist └── Pop_upMenuTests.m ├── Pop-upMenuUITests ├── Info.plist └── Pop_upMenuUITests.m ├── LICENSE ├── .gitignore ├── LvPopupMenu.podspec └── README.md /Pop-upMenu/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListGPS.imageset/@2_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListGPS.imageset/@2_08.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListGPS.imageset/未标题-1_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListGPS.imageset/未标题-1_08.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListRFID.imageset/未标题-6_33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListRFID.imageset/未标题-6_33.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListRFID.imageset/未标题-6_34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListRFID.imageset/未标题-6_34.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListMonitor.imageset/未标题-6_41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListMonitor.imageset/未标题-6_41.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListMonitor.imageset/未标题-6_42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListMonitor.imageset/未标题-6_42.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListInspection.imageset/未标题-6_42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListInspection.imageset/未标题-6_42.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListInspection.imageset/未标题-6_43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListInspection.imageset/未标题-6_43.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListWaterLevel.imageset/未标题-6_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListWaterLevel.imageset/未标题-6_48.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListWaterLevel.imageset/未标题-6_49.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListWaterLevel.imageset/未标题-6_49.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListInspection-1.imageset/未标题-6_42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListInspection-1.imageset/未标题-6_42.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListInspection-1.imageset/未标题-6_43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListInspection-1.imageset/未标题-6_43.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListWaterQuality.imageset/未标题-6_50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListWaterQuality.imageset/未标题-6_50.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListWaterQuality.imageset/未标题-6_51.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListWaterQuality.imageset/未标题-6_51.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListInspectionPath.imageset/未标题-6_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListInspectionPath.imageset/未标题-6_36.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListInspectionPath.imageset/未标题-6_37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/ListInspectionPath.imageset/未标题-6_37.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.15.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.22.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.27.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.29.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.32.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.35.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.37.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.39.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.42.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.45.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.56.48.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.57.00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.57.00.png -------------------------------------------------------------------------------- /DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.57.08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/DisplayResources/Simulator Screen Shot - iPhone 8 - 2018-03-19 at 17.57.08.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/tabbar0_n.imageset/nav_button_home_default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/tabbar0_n.imageset/nav_button_home_default@2x.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/tabbar0_n.imageset/nav_button_home_default@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/tabbar0_n.imageset/nav_button_home_default@3x.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/tabbar0_s.imageset/nav_button_home_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/tabbar0_s.imageset/nav_button_home_selected@2x.png -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/tabbar0_s.imageset/nav_button_home_selected@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XiYeLv/PopupMenu/HEAD/Pop-upMenu/Assets.xcassets/tabbar0_s.imageset/nav_button_home_selected@3x.png -------------------------------------------------------------------------------- /Pop-upMenu.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Pop-upMenu/Test/TestViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestViewController.h 3 | // Pop-upMenu 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pop-upMenu/Test/TestTabBarController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestTabBarController.h 3 | // Pop-upMenu 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestTabBarController : UITabBarController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pop-upMenu/Test/TestTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestTableViewController.h 3 | // Pop-upMenu 4 | // 5 | // Created by EastSun on 2018/3/19. 6 | // Copyright © 2018年 EastSun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestTableViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pop-upMenu.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Pop-upMenu/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Pop-upMenu 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Pop-upMenu/Test/TestArrowheadMenuSelectedStateViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestArrowheadMenuSelectedStateViewController.h 3 | // Pop-upMenu 4 | // 5 | // Created by EastSun on 2018/3/19. 6 | // Copyright © 2018年 EastSun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestArrowheadMenuSelectedStateViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pop-upMenu/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Pop-upMenu 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListGPS.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "@2_08.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "未标题-1_08.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListMonitor.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "未标题-6_41.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "未标题-6_42.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListRFID.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "未标题-6_33.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "未标题-6_34.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListInspection-1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "未标题-6_42.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "未标题-6_43.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListInspection.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "未标题-6_42.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "未标题-6_43.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListWaterLevel.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "未标题-6_48.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "未标题-6_49.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListWaterQuality.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "未标题-6_50.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "未标题-6_51.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/ListInspectionPath.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "未标题-6_36.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "未标题-6_37.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/tabbar0_n.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "nav_button_home_default@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "nav_button_home_default@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/tabbar0_s.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "nav_button_home_selected@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "nav_button_home_selected@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Pop-upMenuTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Pop-upMenuUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Pop-upMenu/XYMenu/CenterMenu.h: -------------------------------------------------------------------------------- 1 | // 2 | // CenterMenu.h 3 | // 弹窗菜单 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import "BaseMenuViewController.h" 10 | 11 | @interface CenterMenu : BaseMenuViewController 12 | 13 | #pragma mark- 默认风格 14 | - (instancetype _Nullable)initDefaultCenterMenuWithTitle:(NSArray *_Nonnull)titleArray icon:(NSArray *_Nullable)iconArray; 15 | 16 | #pragma mark- 自定义风格 17 | - (instancetype _Nullable)initCustomCenterMenuWithTitle:(NSArray *_Nonnull)titleArray icon:(NSArray *_Nullable)iconArray menuUnitSize:(CGSize)size menuCornerRadius:(CGFloat)menuRoundedRadius menuFont:(UIFont * _Nullable)font menuFontColor:(UIColor * _Nullable)fontColor menuBackColor:(UIColor *_Nullable)menuBackColor menuSegmentingLineColor:(UIColor *_Nullable)separatorColor menuMaskColor:(UIColor *_Nullable)menuMaskColor; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Pop-upMenuTests/Pop_upMenuTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Pop_upMenuTests.m 3 | // Pop-upMenuTests 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Pop_upMenuTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation Pop_upMenuTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 XiYe 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Pop-upMenuUITests/Pop_upMenuUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Pop_upMenuUITests.m 3 | // Pop-upMenuUITests 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Pop_upMenuUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation Pop_upMenuUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Pop-upMenu/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Pop-upMenu/XYMenu/UIView+DrawGraphics.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DrawGraphics.h 3 | // 贝塞尔曲线绘图 4 | // 5 | // Created by EastSun on 2017/12/20. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (DrawGraphics) 12 | 13 | #pragma mark- 箭头始终在视图中间 14 | - (void)getTopArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius; 15 | 16 | - (void)getBottomArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius; 17 | 18 | - (void)getLeftArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius; 19 | 20 | - (void)getRightArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius; 21 | 22 | 23 | #pragma mark- 尖角箭头始终指向触发位置的中间 24 | - (void)getTopArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius startPoint:(CGPoint)startPoint; 25 | 26 | - (void)getBottomArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius startPoint:(CGPoint)startPoint; 27 | 28 | - (void)getLeftArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius startPoint:(CGPoint)startPoint; 29 | 30 | - (void)getRightArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius startPoint:(CGPoint)startPoint; 31 | 32 | #pragma mark- 圆角箭头始终指向触发位置的中间 33 | - (void)getBottomRoundedArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius startPoint:(CGPoint)startPoint; 34 | 35 | - (void)getTopRoundedArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius startPoint:(CGPoint)startPoint; 36 | 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /Pop-upMenu/XYMenu/BaseMenuViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseMenuViewController.m 3 | // 弹窗菜单 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import "BaseMenuViewController.h" 10 | 11 | @interface BaseMenuViewController () 12 | 13 | @end 14 | 15 | @implementation BaseMenuViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | #pragma mark- 1.重写init方法,定义modalPresentationStyle 28 | - (instancetype)init { 29 | self = [super init]; 30 | if (self) { 31 | // VC的默认modalPresentationStyle是UIModalPresentationFullScreen,必须重新设置modal样式,否则推出来的VC不会是透明的 32 | self.modalPresentationStyle = UIModalPresentationOverFullScreen; 33 | } 34 | 35 | return self; 36 | } 37 | 38 | #pragma mark- 2.实现菜单推出方法 39 | - (void)presentMenuView { 40 | 41 | // 获取根式控制器rootViewController,并将rootViewController设置为当前主控制器(防止菜单弹出时,部分被导航栏或标签栏遮盖) 42 | UIWindow *window = [UIApplication sharedApplication].keyWindow; 43 | UIViewController *rootVC = window.rootViewController; 44 | rootVC.definesPresentationContext = YES; 45 | // 当前主控制器推出菜单栏 46 | if (rootVC.presentedViewController == nil) { 47 | [rootVC presentViewController:self animated:NO completion:nil]; 48 | } 49 | } 50 | 51 | #pragma mark- 3.菜单移除方法 52 | - (void)removeMenuView { 53 | [self dismissViewControllerAnimated:NO completion:nil]; 54 | } 55 | 56 | #pragma mark- 4.点击菜单栏View,消失(根据需求,看虚不需要) 57 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 58 | [self removeMenuView];// 移除菜单 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Pop-upMenu/XYMenu/BaseMenuViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseMenuViewController.h 3 | // 弹窗菜单 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UIView+DrawGraphics.h" 11 | 12 | // 菜单展示位置单例 13 | typedef NS_ENUM(NSInteger, MenuPlacements) { 14 | ShowAtTop = 0, 15 | ShowAtLeft, 16 | ShowAtBottom, 17 | ShowAtRight 18 | }; 19 | 20 | // 菜单展示动画单例 21 | typedef NS_ENUM(NSInteger, MenuShowAnimationStyle) { 22 | ShowAnimationDefault = 0,// 没有动画 23 | ShowAnimationZoom// 缩放动画 24 | }; 25 | 26 | // 弹窗箭头的样式 27 | typedef NS_ENUM(NSUInteger, MenuArrowStyle) { 28 | MenuArrowStyleRound = 0, // 圆角箭头 29 | MenuArrowStyleTriangle// 菱角箭头 30 | }; 31 | 32 | @class BaseMenuViewController; 33 | // 协议 34 | @protocol MenuViewControllerDelegate 35 | 36 | @optional 37 | 38 | /** 39 | 使用不带选中状态的菜单需要实现的协议方法 40 | 41 | @param tag 被点击的菜单单元标志值 42 | @param title 被点击的菜单单元标题 43 | */ 44 | - (void)menu:(BaseMenuViewController *)menu didClickedItemUnitWithTag:(NSInteger)tag andItemUnitTitle:(NSString *)title; 45 | 46 | /** 47 | 使用带选中状态的菜单需要实现的协议方法 48 | 49 | @param tag 被点击的菜单单元标志值 50 | @param title 被点击的菜单单元标题 51 | @param state 菜单单元点击后的状态 52 | */ 53 | - (void)menu:(BaseMenuViewController *)menu didClickedMenuItemUnitWithTag:(NSInteger)tag andItemUnitTitle:(NSString *)title itemiUnitPostClickState :(BOOL)state; 54 | 55 | @end 56 | 57 | // 菜单箭头高度 58 | static CGFloat const ARROWHEIGHT = 10.f; 59 | // 菜单圆润度 60 | static CGFloat const MENUCORNERRADIUS = 5.f; 61 | 62 | @interface BaseMenuViewController : UIViewController 63 | 64 | /** 菜单弹出方法 */ 65 | - (void)presentMenuView; 66 | 67 | /** 菜单移除方法 */ 68 | - (void)removeMenuView; 69 | 70 | /** 代理对象 */ 71 | @property (nonatomic, weak) id delegate; 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /Pop-upMenu/XYMenu/ArrowheadMenu.h: -------------------------------------------------------------------------------- 1 | // 2 | // ArrowheadMenu.h 3 | // 弹窗菜单 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import "BaseMenuViewController.h" 10 | 11 | @interface ArrowheadMenu : BaseMenuViewController 12 | 13 | #pragma mark- 自定义风格 14 | 15 | /** 16 | 自定义UI风格创建菜单,根据自己风格设置菜单UI元素 17 | 18 | @param titleArray 菜单单元标题 19 | @param iconArray 菜单单元图标,存放image的名字字符串 20 | @param size 菜单单元格的大小(宽和高) 21 | @param font 菜单标题字体 22 | @param fontColor 菜单字体颜色 23 | @param menuBackColor 菜单背景颜色 24 | @param separatorColor 菜单单元分割线颜色 25 | @param interval 菜单距离触发菜单的控件的距离,可为负数 26 | @param arrowStyle 菜单箭头的风格,尖角和圆角两种 27 | @param placements 菜单相对于触发菜单的控件的位置(上、下、左、右四种) 28 | @param animation 菜单弹出动画 29 | @return 返回菜单对象 30 | */ 31 | - (instancetype _Nullable)initCustomArrowheadMenuWithTitle:(NSArray *_Nonnull)titleArray icon:(NSArray *_Nullable)iconArray menuUnitSize:(CGSize)size menuFont:(UIFont * _Nullable)font menuFontColor:(UIColor * _Nullable)fontColor menuBackColor:(UIColor *_Nullable)menuBackColor menuSegmentingLineColor:(UIColor *_Nullable)separatorColor distanceFromTriggerSwitch:(CGFloat)interval menuArrowStyle:(MenuArrowStyle)arrowStyle menuPlacements:(MenuPlacements)placements showAnimationEffects:(MenuShowAnimationStyle)animation; 32 | 33 | #pragma mark- 默认风格 34 | 35 | /** 36 | 默认UI风格菜单,快速创建菜单 37 | 38 | @param titleArray 菜单单元标题 39 | @param iconArray 菜单单元图标,存放image的名字字符串 40 | @param placements 菜单相对于触发菜单的控件的位置(上、下、左、右四种) 41 | @return 返回菜单对象 42 | */ 43 | - (instancetype _Nullable)initDefaultArrowheadMenuWithTitle:(NSArray *_Nonnull)titleArray icon:(NSArray *_Nullable)iconArray menuPlacements:(MenuPlacements)placements; 44 | 45 | 46 | /** 47 | 菜单展示API 48 | 49 | @param sender 触发菜单的控件 50 | */ 51 | - (void)presentMenuView:(NSObject *_Nonnull)sender; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Pop-upMenu/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Pop-upMenu/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Pop-upMenu/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Pop-upMenu/Test/TestTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestTableViewController.m 3 | // Pop-upMenu 4 | // 5 | // Created by EastSun on 2018/3/19. 6 | // Copyright © 2018年 EastSun. All rights reserved. 7 | // 8 | 9 | #import "TestTableViewController.h" 10 | #import "ArrowheadMenu.h" 11 | 12 | @interface TestTableViewController () 13 | 14 | @end 15 | 16 | @implementation TestTableViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | 21 | 22 | self.view.backgroundColor = [UIColor whiteColor]; 23 | self.tableView.tableFooterView = [[UIView alloc] init]; 24 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"]; 25 | } 26 | 27 | - (void)didReceiveMemoryWarning { 28 | [super didReceiveMemoryWarning]; 29 | // Dispose of any resources that can be recreated. 30 | } 31 | 32 | 33 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 34 | return 1; 35 | } 36 | 37 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 38 | return 40; 39 | } 40 | 41 | 42 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 43 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath]; 44 | 45 | cell.textLabel.text = [NSString stringWithFormat:@"%ld---%ld", indexPath.row, indexPath.section]; 46 | 47 | 48 | 49 | return cell; 50 | } 51 | 52 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 53 | 54 | UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 55 | ArrowheadMenu *VC = [[ArrowheadMenu alloc] initDefaultArrowheadMenuWithTitle:@[@"发起群聊", @"添加朋友", @"扫一扫"] icon:nil menuPlacements:ShowAtBottom]; 56 | 57 | VC.delegate = self; 58 | [VC presentMenuView:cell]; 59 | } 60 | 61 | #pragma mark - 菜单代理方法 62 | - (void)menu:(BaseMenuViewController *)menu didClickedItemUnitWithTag:(NSInteger)tag andItemUnitTitle:(NSString *)title { 63 | 64 | NSLog(@"\n\n\n\n点击了第%lu项名字为%@的菜单项", tag, title); 65 | 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /Pop-upMenu/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Pop-upMenu 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "TestTabBarController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 22 | self.window.backgroundColor = [UIColor whiteColor]; 23 | self.window.rootViewController = [[TestTabBarController alloc] init]; 24 | [self.window makeKeyAndVisible]; 25 | return YES; 26 | } 27 | 28 | 29 | - (void)applicationWillResignActive:(UIApplication *)application { 30 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 31 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 32 | } 33 | 34 | 35 | - (void)applicationDidEnterBackground:(UIApplication *)application { 36 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 37 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 38 | } 39 | 40 | 41 | - (void)applicationWillEnterForeground:(UIApplication *)application { 42 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 43 | } 44 | 45 | 46 | - (void)applicationDidBecomeActive:(UIApplication *)application { 47 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 48 | } 49 | 50 | 51 | - (void)applicationWillTerminate:(UIApplication *)application { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | } 54 | 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Pop-upMenu/Test/TestTabBarController.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // TestTabBarController.m 4 | // Pop-upMenu 5 | // 6 | // Created by EastSun on 2017/12/21. 7 | // Copyright © 2017年 EastSun. All rights reserved. 8 | // 9 | 10 | #import "TestTabBarController.h" 11 | #import "ArrowheadMenu.h" 12 | 13 | @interface TestTabBarController () 14 | 15 | /** 标题数组 */ 16 | @property (strong, nonatomic) NSArray *titleArray; 17 | 18 | /** 控制器数组 */ 19 | @property (strong, nonatomic) NSArray *controllerArray; 20 | 21 | @end 22 | 23 | @implementation TestTabBarController 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | // Do any additional setup after loading the view. 28 | 29 | // 添加控制器 30 | [self addControllers]; 31 | } 32 | 33 | - (void)didReceiveMemoryWarning { 34 | [super didReceiveMemoryWarning]; 35 | // Dispose of any resources that can be recreated. 36 | } 37 | 38 | - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item { 39 | 40 | ArrowheadMenu *VC = [[ArrowheadMenu alloc] initDefaultArrowheadMenuWithTitle:@[@"发起群聊", @"添加朋友", @"扫一扫"] icon:@[@"ListInspection", @"ListInspection", @"ListInspection"] menuPlacements:ShowAtTop]; 41 | 42 | VC.delegate = self; 43 | [VC presentMenuView:item]; 44 | } 45 | 46 | // 菜单代理方法 47 | - (void)menu:(BaseMenuViewController *)menu didClickedItemUnitWithTag:(NSInteger)tag andItemUnitTitle:(NSString *)title { 48 | NSLog(@"\n\n\n\n点击了第%lu项名字为%@的菜单项", tag, title); 49 | } 50 | 51 | #pragma mark- 添加控制器 52 | - (void)addControllers{ 53 | for (int i = 0; i < self.titleArray.count; i ++) { 54 | Class class = NSClassFromString(self.controllerArray[i]); 55 | UIViewController *VC = [[class alloc] init]; 56 | VC.title = self.titleArray[i]; 57 | [VC.tabBarItem setTitle:self.titleArray[i]]; 58 | VC.tabBarItem.tag = i; 59 | 60 | [VC.tabBarItem setImage:[[UIImage imageNamed:@"tabbar0_n"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]]; 61 | [VC.tabBarItem setSelectedImage:[[UIImage imageNamed:@"tabbar0_s"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]]; 62 | UINavigationController *NaVC = [[UINavigationController alloc] initWithRootViewController:VC]; 63 | [self addChildViewController:NaVC]; 64 | } 65 | 66 | // 设置tabBarItem标题的选中字体颜色和图片的选中渲染色(图片渲染色必须在添加图片时没有设置图片的imageWithRenderingMode才有效) 67 | self.tabBar.translucent = NO; 68 | 69 | } 70 | 71 | #pragma mark- 懒加载 72 | //MARK: 标题数组titleArray 73 | - (NSArray *)titleArray { 74 | if (!_titleArray) { 75 | _titleArray = @[@"弹出菜单",@"cell弹出菜单",@"测试选中状态菜单",@"test4"]; 76 | } 77 | 78 | return _titleArray; 79 | } 80 | 81 | //MARK: 控制器数组controllerArray 82 | - (NSArray *)controllerArray { 83 | if (!_controllerArray) { 84 | _controllerArray = @[@"TestViewController", @"TestTableViewController", @"TestArrowheadMenuSelectedStateViewController", @"TestViewController"]; 85 | 86 | } 87 | 88 | return _controllerArray; 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /Pop-upMenu/XYMenu/ArrowheadMenuSelectedState.h: -------------------------------------------------------------------------------- 1 | // 2 | // ArrowheadMenuSelectedState.h 3 | // Pop-upMenu 4 | // 5 | // Created by EastSun on 2018/3/19. 6 | // Copyright © 2018年 EastSun. All rights reserved. 7 | // 8 | 9 | #import "BaseMenuViewController.h" 10 | 11 | 12 | 13 | @interface ArrowheadMenuSelectedState : BaseMenuViewController 14 | 15 | /** 16 | 是否允许多选,默认是单选 17 | */ 18 | @property (nonatomic, assign) BOOL allowsMultipleSelection; 19 | 20 | #pragma mark- 默认风格 21 | 22 | /** 23 | 默认UI风格创建菜单 24 | 25 | @param normalTitleArray 非选中状态下,菜单单元标题 26 | @param selectedTitleArray 选中状态下,菜单单元标题 27 | @param normalIconArray 非选中状态下,菜单单元图标,存放image的名字字符串 28 | @param selectedIconArray 选中状态下,菜单单元图标,存放image的名字字符串 29 | @param normalTitleColor 非选中状态下,菜单单元字体颜色 30 | @param selectedTitleColor 选中状态下,菜单单元字体颜色 31 | @param placements 菜单相对于触发菜单的控件的位置(上、下、左、右四种) 32 | @return 返回菜单对象 33 | */ 34 | - (instancetype _Nullable)initDefaultArrowheadStatusMenuWithNormalTitle:(NSArray *_Nonnull)normalTitleArray selectedTitle:(NSArray *_Nonnull)selectedTitleArray normalIcon:(NSArray *_Nullable)normalIconArray selectedIcon:(NSArray *_Nullable)selectedIconArray menuNormalTitleColor:(UIColor * _Nullable)normalTitleColor menuSelectedTitleColor:(UIColor * _Nullable)selectedTitleColor menuPlacements:(MenuPlacements)placements; 35 | 36 | #pragma mark- 自定义风格 37 | /** 38 | 自定义UI风格创建菜单,根据自己风格设置菜单UI元素,菜单每个单元的非选中状态下字体颜色相同,菜单每个单元的选中状态下字体颜色也相同 39 | 40 | @param normalTitleArray 非选中状态下,菜单单元标题 41 | @param selectedTitleArray 选中状态下,菜单单元标题 42 | @param normalIconArray 非选中状态下,菜单单元图标,存放image的名字字符串 43 | @param selectedIconArray 选中状态下,菜单单元图标,存放image的名字字符串 44 | @param normalTitleColor 非选中状态下,菜单单元字体颜色 45 | @param selectedTitleColor 选中状态下,菜单单元字体颜色 46 | @param size 菜单单元格的大小(宽和高) 47 | @param font 菜单单元格标题字体 48 | @param menuBackColor 菜单背景颜色 49 | @param separatorColor 菜单单元分割线颜色 50 | @param interval 菜单距离触发菜单的控件的距离,可为负数 51 | @param arrowStyle 菜单箭头的风格,尖角和圆角两种 52 | @param placements 菜单相对于触发菜单的控件的位置(上、下、左、右四种) 53 | @param animation 菜单弹出动画 54 | @return 返回菜单对象 55 | */ 56 | - (instancetype _Nullable)initCustomArrowheadStatusMenuWithNormalTitle:(NSArray *_Nonnull)normalTitleArray selectedTitle:(NSArray *_Nonnull)selectedTitleArray normalIcon:(NSArray *_Nullable)normalIconArray selectedIcon:(NSArray *_Nullable)selectedIconArray menuNormalTitleColor:(UIColor * _Nonnull)normalTitleColor menuSelectedTitleColor:(UIColor * _Nonnull)selectedTitleColor menuUnitSize:(CGSize)size menuFont:(UIFont * _Nonnull)font menuBackColor:(UIColor *_Nonnull)menuBackColor menuSegmentingLineColor:(UIColor *_Nonnull)separatorColor distanceFromTriggerSwitch:(CGFloat)interval menuArrowStyle:(MenuArrowStyle)arrowStyle menuPlacements:(MenuPlacements)placements showAnimationEffects:(MenuShowAnimationStyle)animation; 57 | 58 | /** 59 | 自定义UI风格创建菜单,根据自己风格设置菜单UI元素,菜单每个单元的非选中状态下字体颜色不相同,菜单每个单元的选中状态下字体颜色也不相同 60 | 61 | @param normalTitleArray 非选中状态下,菜单单元标题 62 | @param selectedTitleArray 选中状态下,菜单单元标题 63 | @param normalIconArray 非选中状态下,菜单单元图标,存放image的名字字符串 64 | @param selectedIconArray 选中状态下,菜单单元图标,存放image的名字字符串 65 | @param normalTitleColorArray 非选中状态下,菜单单元字体颜色 66 | @param selectedTitleColorArray 选中状态下,菜单单元字体颜色 67 | @param size 菜单单元格的大小(宽和高) 68 | @param font 菜单单元格标题字体 69 | @param menuBackColor 菜单背景颜色 70 | @param separatorColor 菜单单元分割线颜色 71 | @param interval 菜单距离触发菜单的控件的距离,可为负数 72 | @param arrowStyle 菜单箭头的风格,尖角和圆角两种 73 | @param placements 菜单相对于触发菜单的控件的位置(上、下、左、右四种) 74 | @param animation 菜单弹出动画 75 | @return 返回菜单对象 76 | */ 77 | - (instancetype _Nullable)initCustomArrowheadStatusMenuWithNormalTitle:(NSArray *_Nonnull)normalTitleArray selectedTitle:(NSArray *_Nonnull)selectedTitleArray normalIcon:(NSArray *_Nullable)normalIconArray selectedIcon:(NSArray *_Nullable)selectedIconArray menuNormalTitleColorArray:(NSArray *_Nonnull)normalTitleColorArray menuSelectedTitleColorArray:(NSArray *_Nonnull)selectedTitleColorArray menuUnitSize:(CGSize)size menuFont:(UIFont * _Nonnull)font menuBackColor:(UIColor *_Nonnull)menuBackColor menuSegmentingLineColor:(UIColor *_Nonnull)separatorColor distanceFromTriggerSwitch:(CGFloat)interval menuArrowStyle:(MenuArrowStyle)arrowStyle menuPlacements:(MenuPlacements)placements showAnimationEffects:(MenuShowAnimationStyle)animation; 78 | 79 | 80 | /** 81 | 菜单展示API 82 | 83 | @param sender 触发菜单的控件 84 | */ 85 | - (void)presentMenuView:(NSObject *_Nonnull)sender; 86 | 87 | /** 88 | 菜单项消除选中状态 89 | 90 | @param tag 菜单的tag标志值 91 | */ 92 | - (void)whenClickedUncheckOwnStatus:(NSInteger)tag; 93 | 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /Pop-upMenu/Test/TestArrowheadMenuSelectedStateViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestArrowheadMenuSelectedStateViewController.m 3 | // Pop-upMenu 4 | // 5 | // Created by EastSun on 2018/3/19. 6 | // Copyright © 2018年 EastSun. All rights reserved. 7 | // 8 | 9 | #import "TestArrowheadMenuSelectedStateViewController.h" 10 | #import "ArrowheadMenuSelectedState.h"// 状态弹窗菜单 11 | 12 | /** RGB颜色 */ 13 | #define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.f green:(g)/255.f blue:(b)/255.f alpha:(a)] 14 | 15 | @interface TestArrowheadMenuSelectedStateViewController () 16 | 17 | // 单选菜单 18 | @property (nonatomic, strong) ArrowheadMenuSelectedState *singleMenu; 19 | // 多选菜单 20 | @property (nonatomic, strong) ArrowheadMenuSelectedState *selectMenu; 21 | 22 | @end 23 | 24 | @implementation TestArrowheadMenuSelectedStateViewController 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | // Do any additional setup after loading the view. 29 | 30 | self.view.backgroundColor = [UIColor orangeColor]; 31 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"单选菜单" style:UIBarButtonItemStyleDone target:self action:@selector(clickSingleMenu:)]; 32 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"多选菜单" style:UIBarButtonItemStyleDone target:self action:@selector(clickSelectMenu:)]; 33 | } 34 | 35 | - (void)didReceiveMemoryWarning { 36 | [super didReceiveMemoryWarning]; 37 | // Dispose of any resources that can be recreated. 38 | } 39 | 40 | #pragma mark- 菜单代理方法 41 | - (void)menu:(BaseMenuViewController *)menu didClickedMenuItemUnitWithTag:(NSInteger)tag andItemUnitTitle:(NSString *)title itemiUnitPostClickState:(BOOL)state { 42 | 43 | if (menu == self.singleMenu) { 44 | NSLog(@"单选菜单"); 45 | } else if (menu == self.selectMenu) { 46 | NSLog(@"多选菜单"); 47 | } 48 | 49 | NSLog(@"%ld---%@---%d", tag, title, state); 50 | 51 | } 52 | 53 | - (void)clickSelectMenu:(UIBarButtonItem *)sender { 54 | [self.selectMenu presentMenuView:sender]; 55 | } 56 | 57 | - (void)clickSingleMenu:(UIBarButtonItem *)sender { 58 | [self.singleMenu presentMenuView:sender]; 59 | } 60 | 61 | - (ArrowheadMenuSelectedState *)singleMenu { 62 | if (!_singleMenu) { 63 | 64 | _singleMenu = [[ArrowheadMenuSelectedState alloc] initCustomArrowheadStatusMenuWithNormalTitle:@[@"监控点", @"RFID点", @"水位测点", @"水质测点", @"巡检", @"GPS路径", @"巡检路径"] selectedTitle:@[@"监控点", @"RFID点", @"水位测点", @"水质测点", @"巡检", @"GPS路径", @"巡检路径"] normalIcon:@[@"ListMonitor", @"ListRFID", @"ListWaterLevel", @"ListWaterQuality", @"ListInspection", @"ListGPS", @"ListInspectionPath"] selectedIcon:@[@"ListMonitor", @"ListRFID", @"ListWaterLevel", @"ListWaterQuality", @"ListInspection", @"ListGPS", @"ListInspectionPath"] menuNormalTitleColorArray:@[RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1)] menuSelectedTitleColorArray:@[RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1)] menuUnitSize:CGSizeMake([UIScreen mainScreen].bounds.size.width/3+5, 38) menuFont:[UIFont fontWithName:@"Helvetica" size:15.f] menuBackColor:RGBACOLOR(248, 247, 242, 0.8) menuSegmentingLineColor:RGBACOLOR(215, 215, 215, 1) distanceFromTriggerSwitch:-5 menuArrowStyle:MenuArrowStyleRound menuPlacements:ShowAtBottom showAnimationEffects:ShowAnimationZoom]; 65 | 66 | _singleMenu.delegate = self; 67 | } 68 | return _singleMenu; 69 | } 70 | 71 | - (ArrowheadMenuSelectedState *)selectMenu { 72 | if(!_selectMenu) { 73 | _selectMenu = [[ArrowheadMenuSelectedState alloc] initCustomArrowheadStatusMenuWithNormalTitle:@[@"监控点", @"RFID点", @"水位测点", @"水质测点", @"巡检", @"GPS路径", @"巡检路径"] selectedTitle:@[@"监控点", @"RFID点", @"水位测点", @"水质测点", @"巡检", @"GPS路径", @"巡检路径"] normalIcon:@[@"ListMonitor", @"ListRFID", @"ListWaterLevel", @"ListWaterQuality", @"ListInspection", @"ListGPS", @"ListInspectionPath"] selectedIcon:@[@"ListMonitor", @"ListRFID", @"ListWaterLevel", @"ListWaterQuality", @"ListInspection", @"ListGPS", @"ListInspectionPath"] menuNormalTitleColorArray:@[RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1)] menuSelectedTitleColorArray:@[RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1)] menuUnitSize:CGSizeMake([UIScreen mainScreen].bounds.size.width/3+5, 38) menuFont:[UIFont fontWithName:@"Helvetica" size:15.f] menuBackColor:RGBACOLOR(248, 247, 242, 0.8) menuSegmentingLineColor:RGBACOLOR(215, 215, 215, 1) distanceFromTriggerSwitch:-5 menuArrowStyle:MenuArrowStyleRound menuPlacements:ShowAtBottom showAnimationEffects:ShowAnimationZoom]; 74 | 75 | _selectMenu.delegate = self; 76 | _selectMenu.allowsMultipleSelection = YES; 77 | } 78 | 79 | return _selectMenu; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /LvPopupMenu.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint PopupMenu.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | s.name = "LvPopupMenu" 19 | s.version = "1.0.0" 20 | s.summary = "A simple and practical pop-up assembly --Lv" 21 | 22 | # This description is used to generate tags and improve search results. 23 | # * Think: What does it do? Why did you write it? What is the focus? 24 | # * Try to keep it short, snappy and to the point. 25 | # * Write the description between the DESC delimiters below. 26 | # * Finally, don't worry about the indent, CocoaPods strips it! 27 | 28 | 29 | s.homepage = "https://github.com/XiYeLv/PopupMenu" 30 | # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" 31 | 32 | 33 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 34 | # 35 | # Licensing your code is important. See http://choosealicense.com for more info. 36 | # CocoaPods will detect a license file if there is a named LICENSE* 37 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 38 | # 39 | 40 | s.license = { :type => "MIT", :file => "LICENSE" } 41 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 42 | 43 | 44 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 45 | # 46 | # Specify the authors of the library, with email addresses. Email addresses 47 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 48 | # accepts just a name if you'd rather not provide an email address. 49 | # 50 | # Specify a social_media_url where others can refer to, for example a twitter 51 | # profile URL. 52 | # 53 | 54 | s.author = { "Lv" => "dmonkey@vip.qq.com" } 55 | # Or just: s.author = "WaWa" 56 | # s.authors = { "WaWa" => "1919898597@qq.com" } 57 | # s.social_media_url = "http://twitter.com/WaWa" 58 | 59 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 60 | # 61 | # If this Pod runs only on iOS or OS X, then specify the platform and 62 | # the deployment target. You can optionally include the target after the platform. 63 | # 64 | 65 | s.platform = :ios, "8.0" 66 | # s.platform = :ios, "5.0" 67 | 68 | # When using multiple platforms 69 | # s.ios.deployment_target = "5.0" 70 | # s.osx.deployment_target = "10.7" 71 | # s.watchos.deployment_target = "2.0" 72 | # s.tvos.deployment_target = "9.0" 73 | 74 | 75 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 76 | # 77 | # Specify the location from where the source should be retrieved. 78 | # Supports git, hg, bzr, svn and HTTP. 79 | # 80 | 81 | s.source = { :git => "https://github.com/XiYeLv/PopupMenu.git", :tag => "#{s.version}" } 82 | 83 | 84 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 85 | # 86 | # CocoaPods is smart about how it includes source code. For source files 87 | # giving a folder will include any swift, h, m, mm, c & cpp files. 88 | # For header files it will include any header in the folder. 89 | # Not including the public_header_files will make all headers public. 90 | # 91 | 92 | s.source_files = 'Pop-upMenu/XYMenu/*.{h,m}' 93 | # s.exclude_files = "Classes/Exclude" 94 | 95 | s.public_header_files = "Pop-upMenu/XYMenu/*.{h}" 96 | 97 | 98 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 99 | # 100 | # A list of resources included with the Pod. These are copied into the 101 | # target bundle with a build phase script. Anything else will be cleaned. 102 | # You can preserve files from being cleaned, please don't preserve 103 | # non-essential files like tests, examples and documentation. 104 | # 105 | 106 | # s.resource = "icon.png" 107 | # s.resources = "Resources/*.png" 108 | 109 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 110 | 111 | 112 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 113 | # 114 | # Link your library with frameworks, or libraries. Libraries do not include 115 | # the lib prefix of their name. 116 | # 117 | 118 | # s.framework = "SomeFramework" 119 | # s.frameworks = "SomeFramework", "AnotherFramework" 120 | 121 | # s.library = "iconv" 122 | # s.libraries = "iconv", "xml2" 123 | 124 | 125 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 126 | # 127 | # If your library depends on compiler flags you can set them in the xcconfig hash 128 | # where they will only apply to your library. If you depend on other Podspecs 129 | # you can include multiple dependencies to ensure it works. 130 | 131 | s.requires_arc = true 132 | 133 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 134 | # s.dependency "JSONKit", "~> 1.4" 135 | 136 | end 137 | -------------------------------------------------------------------------------- /Pop-upMenu/Test/TestViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestViewController.m 3 | // Pop-upMenu 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import "TestViewController.h" 10 | #import "ArrowheadMenu.h"// 箭头菜单 11 | #import "CenterMenu.h"// 中心菜单 12 | 13 | @interface TestViewController () 14 | 15 | @end 16 | 17 | @implementation TestViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view. 22 | self.view.backgroundColor = [UIColor purpleColor]; 23 | 24 | // 孙视图触发 25 | UIView *childView = [[UIView alloc] initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, self.view.frame.size.width)]; 26 | childView.backgroundColor = [UIColor blueColor]; 27 | [self.view addSubview:childView]; 28 | 29 | UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom]; 30 | btn1.frame = CGRectMake((childView.frame.size.width-150)/2, 10, 150, 50); 31 | btn1.backgroundColor = [UIColor orangeColor]; 32 | [btn1 setTitle:@"孙视图向下触发" forState:UIControlStateNormal]; 33 | [btn1 addTarget:self action:@selector(bottomClick:) forControlEvents:UIControlEventTouchUpInside]; 34 | [childView addSubview:btn1]; 35 | UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeCustom]; 36 | btn2.frame = CGRectMake((childView.frame.size.width-150)/2, (childView.frame.size.height-50-10), 150, 50); 37 | btn2.backgroundColor = [UIColor orangeColor]; 38 | [btn2 setTitle:@"孙视图向上触发" forState:UIControlStateNormal]; 39 | [btn2 addTarget:self action:@selector(topClick:) forControlEvents:UIControlEventTouchUpInside]; 40 | [childView addSubview:btn2]; 41 | 42 | UIButton *btn3 = [UIButton buttonWithType:UIButtonTypeCustom]; 43 | btn3.frame = CGRectMake(childView.frame.size.width/2-5-30, (childView.frame.size.height-150)/2, 30, 150); 44 | btn3.backgroundColor = [UIColor orangeColor]; 45 | [btn3 setTitle:@"left" forState:UIControlStateNormal]; 46 | [btn3 addTarget:self action:@selector(leftClick:) forControlEvents:UIControlEventTouchUpInside]; 47 | [childView addSubview:btn3]; 48 | 49 | UIButton *btn4 = [UIButton buttonWithType:UIButtonTypeCustom]; 50 | btn4.frame = CGRectMake(childView.frame.size.width/2+5, (childView.frame.size.height-150)/2, 30, 150); 51 | btn4.backgroundColor = [UIColor orangeColor]; 52 | [btn4 setTitle:@"right" forState:UIControlStateNormal]; 53 | [btn4 addTarget:self action:@selector(rightClick:) forControlEvents:UIControlEventTouchUpInside]; 54 | [childView addSubview:btn4]; 55 | 56 | 57 | // 左右导航栏按钮触发 58 | UIBarButtonItem *right1 = [[UIBarButtonItem alloc] initWithTitle:@"右触发1" style:UIBarButtonItemStylePlain target:self action:@selector(clickto:)]; 59 | UIBarButtonItem *right2 = [[UIBarButtonItem alloc] initWithTitle:@"右触发2" style:UIBarButtonItemStylePlain target:self action:@selector(clickto:)]; 60 | self.navigationItem.rightBarButtonItems = @[right1, right2]; 61 | 62 | UIBarButtonItem *left1 = [[UIBarButtonItem alloc] initWithTitle:@"左触发1" style:UIBarButtonItemStylePlain target:self action:@selector(clickto:)]; 63 | UIBarButtonItem *left2 = [[UIBarButtonItem alloc] initWithTitle:@"左触发2" style:UIBarButtonItemStylePlain target:self action:@selector(clickto:)]; 64 | self.navigationItem.leftBarButtonItems = @[left1, left2]; 65 | 66 | } 67 | 68 | 69 | - (void)didReceiveMemoryWarning { 70 | [super didReceiveMemoryWarning]; 71 | // Dispose of any resources that can be recreated. 72 | 73 | 74 | } 75 | 76 | #pragma mark - 菜单代理方法 77 | - (void)menu:(BaseMenuViewController *)menu didClickedItemUnitWithTag:(NSInteger)tag andItemUnitTitle:(NSString *)title { 78 | 79 | NSLog(@"\n\n\n\n点击了第%lu项名字为%@的菜单项", tag, title); 80 | 81 | } 82 | 83 | 84 | - (void)bottomClick:(UIButton *)sender { 85 | 86 | ArrowheadMenu *VC = [[ArrowheadMenu alloc] initDefaultArrowheadMenuWithTitle:@[@"发起群聊", @"添加朋友", @"扫一扫"] icon:nil menuPlacements:ShowAtBottom]; 87 | 88 | VC.delegate = self; 89 | [VC presentMenuView:sender]; 90 | } 91 | 92 | - (void)topClick:(UIButton *)sender { 93 | 94 | ArrowheadMenu *VC = [[ArrowheadMenu alloc] initDefaultArrowheadMenuWithTitle:@[@"发起群聊", @"添加朋友", @"扫一扫"] icon:@[@"ListInspection", @"ListInspection", @"ListInspection"] menuPlacements:ShowAtTop]; 95 | 96 | VC.delegate = self; 97 | [VC presentMenuView:sender]; 98 | } 99 | 100 | - (void)leftClick:(UIButton *)sender { 101 | 102 | ArrowheadMenu *VC = [[ArrowheadMenu alloc] initDefaultArrowheadMenuWithTitle:@[@"发起群聊", @"添加朋友", @"扫一扫"] icon:@[@"ListInspection", @"ListInspection", @"ListInspection"] menuPlacements:ShowAtLeft]; 103 | 104 | VC.delegate = self; 105 | [VC presentMenuView:sender]; 106 | 107 | } 108 | 109 | - (void)rightClick:(UIButton *)sender { 110 | 111 | ArrowheadMenu *VC = [[ArrowheadMenu alloc] initDefaultArrowheadMenuWithTitle:@[@"发起群聊", @"添加朋友", @"扫一扫"] icon:@[@"ListInspection", @"ListInspection", @"ListInspection"] menuPlacements:ShowAtRight]; 112 | 113 | VC.delegate = self; 114 | [VC presentMenuView:sender]; 115 | } 116 | 117 | - (void)clickto:(UIBarButtonItem *)sender { 118 | 119 | ArrowheadMenu *VC = [[ArrowheadMenu alloc] initDefaultArrowheadMenuWithTitle:@[@"发起群聊", @"添加朋友", @"扫一扫"] icon:@[@"ListInspection", @"ListInspection", @"ListInspection"] menuPlacements:ShowAtBottom]; 120 | 121 | VC.delegate = self; 122 | [VC presentMenuView:sender]; 123 | 124 | } 125 | 126 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 127 | 128 | 129 | CenterMenu *VC = [[CenterMenu alloc] initDefaultCenterMenuWithTitle:@[@"发起群聊", @"添加朋友", @"扫一扫"] icon:@[@"ListInspection", @"ListInspection", @"ListInspection"]]; 130 | VC.delegate = self; 131 | [VC presentMenuView]; 132 | } 133 | 134 | @end 135 | -------------------------------------------------------------------------------- /Pop-upMenu/XYMenu/CenterMenu.m: -------------------------------------------------------------------------------- 1 | // 2 | // CenterMenu.m 3 | // 弹窗菜单 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import "CenterMenu.h" 10 | 11 | @interface CenterMenu () 12 | 13 | /** 14 | 菜单项 15 | */ 16 | @property (nonatomic, strong) UITableView *menuTableView; 17 | 18 | /** 19 | 标题数组 20 | */ 21 | @property (nonatomic, strong) NSArray *titleArray; 22 | 23 | /** 24 | 图表数组 25 | */ 26 | @property (nonatomic, strong) NSArray *iconArray; 27 | 28 | /** 29 | 菜单字体 30 | */ 31 | @property (nonatomic, strong) UIFont *font; 32 | 33 | /** 34 | 菜单字体颜色 35 | */ 36 | @property (nonatomic, strong) UIColor *fontColor; 37 | 38 | /** 39 | 菜单背景颜色 40 | */ 41 | @property (nonatomic, strong) UIColor *menuBackColor; 42 | 43 | /** 44 | 菜单分割线的颜色 45 | */ 46 | @property (nonatomic, strong) UIColor *separatorColor; 47 | 48 | /** 49 | 菜单遮罩层颜色 50 | */ 51 | @property (nonatomic, strong) UIColor *menuMaskColor; 52 | 53 | /** 54 | 菜单项目的位置 55 | */ 56 | @property (nonatomic, assign) CGRect menuItemRect; 57 | 58 | /** 59 | 菜单圆角半径 60 | */ 61 | @property (nonatomic, assign) CGFloat menuRoundedRadius; 62 | 63 | /** 64 | 菜单项目单元格高度 65 | */ 66 | @property (nonatomic, assign) CGFloat cellHeight; 67 | 68 | @end 69 | 70 | @implementation CenterMenu 71 | 72 | #pragma mark- 实例化菜单 73 | - (instancetype)initDefaultCenterMenuWithTitle:(NSArray *)titleArray icon:(NSArray *)iconArray { 74 | return [self initCustomCenterMenuWithTitle:titleArray icon:iconArray menuUnitSize:CGSizeMake([UIScreen mainScreen].bounds.size.width/2, 44) menuCornerRadius:5 menuFont:[UIFont fontWithName:@"Helvetica" size:18.f] menuFontColor:[UIColor blackColor] menuBackColor:[UIColor colorWithWhite:1 alpha:0.8] menuSegmentingLineColor:[UIColor colorWithRed:192/255.f green:196/255.f blue:201/255.f alpha:1] menuMaskColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0.3]]; 75 | 76 | } 77 | 78 | #pragma mark- 自定义风格 79 | - (instancetype)initCustomCenterMenuWithTitle:(NSArray *)titleArray icon:(NSArray *)iconArray menuUnitSize:(CGSize)size menuCornerRadius:(CGFloat)menuRoundedRadius menuFont:(UIFont *)font menuFontColor:(UIColor *)fontColor menuBackColor:(UIColor *)menuBackColor menuSegmentingLineColor:(UIColor *)separatorColor menuMaskColor:(UIColor * _Nullable)menuMaskColor { 80 | 81 | self = [super init]; 82 | if (self) { 83 | 84 | self.titleArray = titleArray; 85 | self.iconArray = iconArray; 86 | self.cellHeight = size.height;// 菜单单元格高度 87 | self.menuRoundedRadius = menuRoundedRadius; 88 | self.font = font; 89 | self.fontColor = fontColor; 90 | self.menuBackColor = menuBackColor; 91 | self.separatorColor = separatorColor; 92 | self.menuMaskColor = menuMaskColor; 93 | 94 | ; 95 | self.menuItemRect = CGRectMake(([UIScreen mainScreen].bounds.size.width - size.width)/2, ([UIScreen mainScreen].bounds.size.height-size.height*titleArray.count)/2, size.width, size.height*titleArray.count); 96 | } 97 | return self; 98 | } 99 | 100 | #pragma mark- 定制并展示菜单 101 | - (void)viewWillAppear:(BOOL)animated { 102 | [super viewWillAppear:animated]; 103 | 104 | // 1、设置菜单遮罩层颜色 105 | self.view.backgroundColor = self.menuMaskColor; 106 | 107 | // 2、设置展示动态展示动画 108 | self.menuTableView.transform = CGAffineTransformMakeScale(0.0001, 0.0001); 109 | [UIView animateWithDuration:0.2 animations:^{ 110 | [self.view addSubview:self.menuTableView]; 111 | self.menuTableView.transform = CGAffineTransformMakeScale(1.0, 1.0); 112 | }]; 113 | } 114 | 115 | #pragma mark- 移除菜单 116 | - (void)removeMenuView { 117 | [UIView animateWithDuration:0.2 animations:^{ 118 | self.menuTableView.transform = CGAffineTransformMakeScale(0.1, 0.1); 119 | } completion:^(BOOL finished) { 120 | [self.menuTableView removeFromSuperview]; 121 | [self dismissViewControllerAnimated:NO completion:nil]; 122 | }]; 123 | } 124 | 125 | #pragma mark- 菜单TableView代理方法 126 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 127 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 128 | // 1、通知代理处理点击事件 129 | if ([self.delegate respondsToSelector:@selector(menu:didClickedItemUnitWithTag:andItemUnitTitle:)]) { 130 | [self.delegate menu:self didClickedItemUnitWithTag:indexPath.row andItemUnitTitle:self.titleArray[indexPath.row]]; 131 | } 132 | // 2、移除菜单 133 | [self removeMenuView]; 134 | } 135 | 136 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 137 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"%lu-+%lu", indexPath.row, indexPath.section]]; 138 | if (!cell) { 139 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[NSString stringWithFormat:@"%lu-+%lu", indexPath.row, indexPath.section]]; 140 | // 设置标题格式 141 | cell.textLabel.font = self.font; 142 | cell.textLabel.textColor = self.fontColor; 143 | cell.backgroundColor = [UIColor clearColor]; 144 | // 设置菜单点击背景 145 | cell.selectedBackgroundView = [[UIView alloc] initWithFrame:cell.frame]; 146 | cell.selectedBackgroundView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.4]; 147 | // 移除最后一个cell的分割线 148 | if (indexPath.row == [tableView numberOfRowsInSection:indexPath.section]-1) { 149 | 150 | cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, cell.bounds.size.width); 151 | } 152 | 153 | // 设置菜单图标 154 | if (self.iconArray) { 155 | cell.imageView.image = [UIImage imageNamed:self.iconArray[indexPath.row]]; 156 | cell.textLabel.textAlignment = NSTextAlignmentLeft; 157 | } else { 158 | cell.textLabel.textAlignment = NSTextAlignmentCenter; 159 | } 160 | // 设置菜单标题 161 | cell.textLabel.text = self.titleArray[indexPath.row]; 162 | 163 | } 164 | 165 | 166 | return cell; 167 | } 168 | 169 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 170 | return self.cellHeight; 171 | } 172 | 173 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 174 | return self.titleArray.count; 175 | } 176 | 177 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 178 | return 1; 179 | } 180 | 181 | #pragma mark- 懒加载 182 | - (UITableView *)menuTableView { 183 | 184 | if (!_menuTableView) { 185 | _menuTableView = [[UITableView alloc] initWithFrame:self.menuItemRect style:UITableViewStylePlain]; 186 | _menuTableView.center = self.view.center; 187 | _menuTableView.dataSource = self; 188 | _menuTableView.delegate = self; 189 | _menuTableView.bounces = NO; 190 | _menuTableView.showsVerticalScrollIndicator = NO; 191 | _menuTableView.tableFooterView = [[UIView alloc] init]; 192 | 193 | _menuTableView.backgroundColor = self.menuBackColor; 194 | _menuTableView.layer.cornerRadius = self.menuRoundedRadius; 195 | _menuTableView.layer.masksToBounds = YES; 196 | 197 | // 分割线颜色 198 | _menuTableView.separatorColor = self.separatorColor; 199 | // 调整cell的分割线的位置 200 | _menuTableView.separatorInset = UIEdgeInsetsMake(0, 10, 0, 10); 201 | 202 | _menuTableView.layoutMargins = UIEdgeInsetsMake(0, 10, 0, 10); 203 | } 204 | 205 | return _menuTableView; 206 | } 207 | 208 | - (void)viewDidLoad { 209 | [super viewDidLoad]; 210 | // Do any additional setup after loading the view. 211 | } 212 | 213 | - (void)didReceiveMemoryWarning { 214 | [super didReceiveMemoryWarning]; 215 | // Dispose of any resources that can be recreated. 216 | } 217 | 218 | 219 | @end 220 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 目录 2 | 3 | - [效果](#效果) 4 | - [要求](#要求) 5 | - [安装](#安装) 6 | - [使用](#使用) 7 | 8 | # [![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/XiYeLv/PopupMenu/blob/master/LICENSE) 9 | [![CocoaPods](https://img.shields.io/cocoapods/v/LvPopupMenu.svg?style=flat)](http://cocoapods.org/pods/LvPopupMenu) 10 | ![CocoaPods](https://img.shields.io/cocoapods/p/LvPopupMenu.svg?style=flat) 11 | 12 | # 效果 13 | * ![图片](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.56.15.png?raw=true) 14 | * ![](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.56.22.png?raw=true) 15 | * ![](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.56.27.png?raw=true) 16 | * ![](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.56.29.png?raw=true) 17 | * ![](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.56.32.png?raw=true) 18 | * ![](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.56.35.png?raw=true) 19 | * ![](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.56.37.png?raw=true) 20 | * ![](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.56.39.png?raw=true) 21 | * ![](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.56.42.png?raw=true) 22 | * ![](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.56.45.png?raw=true) 23 | * ![](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.56.48.png?raw=true) 24 | * ![](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.57.00.png?raw=true) 25 | * ![](https://github.com/XiYeLv/PopupMenu/blob/master/DisplayResources/Simulator%20Screen%20Shot%20-%20iPhone%208%20-%202018-03-19%20at%2017.57.08.png?raw=true) 26 | 27 | # 要求 28 | * iOS 8.0+ 29 | 30 | # 安装 31 | ## Manually 32 | 将XYMenu文件夹放入工程 33 | 34 | ## CocoaPods 35 | 1. Add `pod 'LvPopupMenu'` to your Podfile. 36 | 2. Run `pod install` or `pod update`. 37 | 38 | # 使用 39 | ## ArrowheadMenu使用 40 | 相关API: 41 | 42 | ``` 43 | #pragma mark- 默认风格 44 | 45 | /** 46 | 默认UI风格菜单,快速创建菜单 47 | 48 | @param titleArray 菜单单元标题 49 | @param iconArray 菜单单元图标,存放image的名字字符串 50 | @param placements 菜单相对于触发菜单的控件的位置(上、下、左、右四种) 51 | @return 返回菜单对象 52 | */ 53 | - (instancetype _Nullable)initDefaultArrowheadMenuWithTitle:(NSArray *_Nonnull)titleArray icon:(NSArray *_Nullable)iconArray menuPlacements:(MenuPlacements)placements; 54 | 55 | /** 56 | 自定义UI风格创建菜单,根据自己风格设置菜单UI元素 57 | 58 | @param titleArray 菜单单元标题 59 | @param iconArray 菜单单元图标,存放image的名字字符串 60 | @param size 菜单单元格的大小(宽和高) 61 | @param font 菜单标题字体 62 | @param fontColor 菜单字体颜色 63 | @param menuBackColor 菜单背景颜色 64 | @param separatorColor 菜单单元分割线颜色 65 | @param interval 菜单距离触发菜单的控件的距离,可为负数 66 | @param arrowStyle 菜单箭头的风格,尖角和圆角两种 67 | @param placements 菜单相对于触发菜单的控件的位置(上、下、左、右四种) 68 | @param animation 菜单弹出动画 69 | @return 返回菜单对象 70 | */ 71 | - (instancetype _Nullable)initCustomArrowheadMenuWithTitle:(NSArray *_Nonnull)titleArray icon:(NSArray *_Nullable)iconArray menuUnitSize:(CGSize)size menuFont:(UIFont * _Nullable)font menuFontColor:(UIColor * _Nullable)fontColor menuBackColor:(UIColor *_Nullable)menuBackColor menuSegmentingLineColor:(UIColor *_Nullable)separatorColor distanceFromTriggerSwitch:(CGFloat)interval menuArrowStyle:(MenuArrowStyle)arrowStyle menuPlacements:(MenuPlacements)placements showAnimationEffects:(MenuShowAnimationStyle)animation; 72 | 73 | /** 74 | 菜单展示API 75 | 76 | @param sender 触发菜单的控件 77 | */ 78 | - (void)presentMenuView:(NSObject *_Nonnull)sender; 79 | ``` 80 | 81 | 协议方法: 82 | 83 | ``` 84 | /** 85 | 使用不带选中状态的菜单需要实现的协议方法 86 | 87 | @param tag 被点击的菜单单元标志值 88 | @param title 被点击的菜单单元标题 89 | */ 90 | - (void)menu:(BaseMenuViewController *)menu didClickedItemUnitWithTag:(NSInteger)tag andItemUnitTitle:(NSString *)title; 91 | ``` 92 | 93 | 使用案例: 94 | 95 | ``` 96 | ArrowheadMenu *menu = [[ArrowheadMenu alloc] initDefaultArrowheadMenuWithTitle:@[@"发起群聊", @"添加朋友", @"扫一扫"] icon:@[@"ListInspection", @"ListInspection", @"ListInspection"] menuPlacements:ShowAtTop]; 97 | menu.delegate = self; 98 | [menu presentMenuView:item]; 99 | ``` 100 | 101 | ## CenterMenu使用 102 | 相关API: 103 | 104 | ``` 105 | #pragma mark- 默认风格 106 | - (instancetype _Nullable)initDefaultCenterMenuWithTitle:(NSArray *_Nonnull)titleArray icon:(NSArray *_Nullable)iconArray; 107 | 108 | #pragma mark- 自定义风格 109 | - (instancetype _Nullable)initCustomCenterMenuWithTitle:(NSArray *_Nonnull)titleArray icon:(NSArray *_Nullable)iconArray menuUnitSize:(CGSize)size menuCornerRadius:(CGFloat)menuRoundedRadius menuFont:(UIFont * _Nullable)font menuFontColor:(UIColor * _Nullable)fontColor menuBackColor:(UIColor *_Nullable)menuBackColor menuSegmentingLineColor:(UIColor *_Nullable)separatorColor menuMaskColor:(UIColor *_Nullable)menuMaskColor; 110 | ``` 111 | 协议方法: 112 | 113 | ``` 114 | /** 115 | 使用不带选中状态的菜单需要实现的协议方法 116 | 117 | @param tag 被点击的菜单单元标志值 118 | @param title 被点击的菜单单元标题 119 | */ 120 | - (void)menu:(BaseMenuViewController *)menu didClickedItemUnitWithTag:(NSInteger)tag andItemUnitTitle:(NSString *)title; 121 | ``` 122 | 123 | 使用案例: 124 | 125 | ``` 126 | CenterMenu *centerMenu = [[CenterMenu alloc] initDefaultCenterMenuWithTitle:@[@"发起群聊", @"添加朋友", @"扫一扫"] icon:@[@"ListInspection", @"ListInspection", @"ListInspection"]]; 127 | centerMenu.delegate = self; 128 | [centerMenu presentMenuView]; 129 | ``` 130 | 131 | # ArrowheadMenuSelectedState使用 132 | 相关API: 133 | 134 | ``` 135 | /** 136 | 是否允许多选,默认是单选 137 | */ 138 | @property (nonatomic, assign) BOOL allowsMultipleSelection; 139 | 140 | #pragma mark- 默认风格 141 | 142 | /** 143 | 默认UI风格创建菜单 144 | 145 | @param normalTitleArray 非选中状态下,菜单单元标题 146 | @param selectedTitleArray 选中状态下,菜单单元标题 147 | @param normalIconArray 非选中状态下,菜单单元图标,存放image的名字字符串 148 | @param selectedIconArray 选中状态下,菜单单元图标,存放image的名字字符串 149 | @param normalTitleColor 非选中状态下,菜单单元字体颜色 150 | @param selectedTitleColor 选中状态下,菜单单元字体颜色 151 | @param placements 菜单相对于触发菜单的控件的位置(上、下、左、右四种) 152 | @return 返回菜单对象 153 | */ 154 | - (instancetype _Nullable)initDefaultArrowheadStatusMenuWithNormalTitle:(NSArray *_Nonnull)normalTitleArray selectedTitle:(NSArray *_Nonnull)selectedTitleArray normalIcon:(NSArray *_Nullable)normalIconArray selectedIcon:(NSArray *_Nullable)selectedIconArray menuNormalTitleColor:(UIColor * _Nullable)normalTitleColor menuSelectedTitleColor:(UIColor * _Nullable)selectedTitleColor menuPlacements:(MenuPlacements)placements; 155 | 156 | #pragma mark- 自定义风格 157 | /** 158 | 自定义UI风格创建菜单,根据自己风格设置菜单UI元素,菜单每个单元的非选中状态下字体颜色相同,菜单每个单元的选中状态下字体颜色也相同 159 | 160 | @param normalTitleArray 非选中状态下,菜单单元标题 161 | @param selectedTitleArray 选中状态下,菜单单元标题 162 | @param normalIconArray 非选中状态下,菜单单元图标,存放image的名字字符串 163 | @param selectedIconArray 选中状态下,菜单单元图标,存放image的名字字符串 164 | @param normalTitleColor 非选中状态下,菜单单元字体颜色 165 | @param selectedTitleColor 选中状态下,菜单单元字体颜色 166 | @param size 菜单单元格的大小(宽和高) 167 | @param font 菜单单元格标题字体 168 | @param menuBackColor 菜单背景颜色 169 | @param separatorColor 菜单单元分割线颜色 170 | @param interval 菜单距离触发菜单的控件的距离,可为负数 171 | @param arrowStyle 菜单箭头的风格,尖角和圆角两种 172 | @param placements 菜单相对于触发菜单的控件的位置(上、下、左、右四种) 173 | @param animation 菜单弹出动画 174 | @return 返回菜单对象 175 | */ 176 | - (instancetype _Nullable)initCustomArrowheadStatusMenuWithNormalTitle:(NSArray *_Nonnull)normalTitleArray selectedTitle:(NSArray *_Nonnull)selectedTitleArray normalIcon:(NSArray *_Nullable)normalIconArray selectedIcon:(NSArray *_Nullable)selectedIconArray menuNormalTitleColor:(UIColor * _Nonnull)normalTitleColor menuSelectedTitleColor:(UIColor * _Nonnull)selectedTitleColor menuUnitSize:(CGSize)size menuFont:(UIFont * _Nonnull)font menuBackColor:(UIColor *_Nonnull)menuBackColor menuSegmentingLineColor:(UIColor *_Nonnull)separatorColor distanceFromTriggerSwitch:(CGFloat)interval menuArrowStyle:(MenuArrowStyle)arrowStyle menuPlacements:(MenuPlacements)placements showAnimationEffects:(MenuShowAnimationStyle)animation; 177 | 178 | /** 179 | 自定义UI风格创建菜单,根据自己风格设置菜单UI元素,菜单每个单元的非选中状态下字体颜色不相同,菜单每个单元的选中状态下字体颜色也不相同 180 | 181 | @param normalTitleArray 非选中状态下,菜单单元标题 182 | @param selectedTitleArray 选中状态下,菜单单元标题 183 | @param normalIconArray 非选中状态下,菜单单元图标,存放image的名字字符串 184 | @param selectedIconArray 选中状态下,菜单单元图标,存放image的名字字符串 185 | @param normalTitleColorArray 非选中状态下,菜单单元字体颜色 186 | @param selectedTitleColorArray 选中状态下,菜单单元字体颜色 187 | @param size 菜单单元格的大小(宽和高) 188 | @param font 菜单单元格标题字体 189 | @param menuBackColor 菜单背景颜色 190 | @param separatorColor 菜单单元分割线颜色 191 | @param interval 菜单距离触发菜单的控件的距离,可为负数 192 | @param arrowStyle 菜单箭头的风格,尖角和圆角两种 193 | @param placements 菜单相对于触发菜单的控件的位置(上、下、左、右四种) 194 | @param animation 菜单弹出动画 195 | @return 返回菜单对象 196 | */ 197 | - (instancetype _Nullable)initCustomArrowheadStatusMenuWithNormalTitle:(NSArray *_Nonnull)normalTitleArray selectedTitle:(NSArray *_Nonnull)selectedTitleArray normalIcon:(NSArray *_Nullable)normalIconArray selectedIcon:(NSArray *_Nullable)selectedIconArray menuNormalTitleColorArray:(NSArray *_Nonnull)normalTitleColorArray menuSelectedTitleColorArray:(NSArray *_Nonnull)selectedTitleColorArray menuUnitSize:(CGSize)size menuFont:(UIFont * _Nonnull)font menuBackColor:(UIColor *_Nonnull)menuBackColor menuSegmentingLineColor:(UIColor *_Nonnull)separatorColor distanceFromTriggerSwitch:(CGFloat)interval menuArrowStyle:(MenuArrowStyle)arrowStyle menuPlacements:(MenuPlacements)placements showAnimationEffects:(MenuShowAnimationStyle)animation; 198 | 199 | 200 | /** 201 | 菜单展示API 202 | 203 | @param sender 触发菜单的控件 204 | */ 205 | - (void)presentMenuView:(NSObject *_Nonnull)sender; 206 | 207 | /** 208 | 菜单项消除选中状态 209 | 210 | @param tag 菜单的tag标志值 211 | */ 212 | - (void)whenClickedUncheckOwnStatus:(NSInteger)tag; 213 | ``` 214 | 协议方法: 215 | 216 | ``` 217 | /** 218 | 使用带选中状态的菜单需要实现的协议方法 219 | 220 | @param tag 被点击的菜单单元标志值 221 | @param title 被点击的菜单单元标题 222 | @param state 菜单单元点击后的状态 223 | */ 224 | - (void)menu:(BaseMenuViewController *)menu didClickedMenuItemUnitWithTag:(NSInteger)tag andItemUnitTitle:(NSString *)title itemiUnitPostClickState :(BOOL)state; 225 | ``` 226 | 227 | 使用案例: 228 | 229 | ``` 230 | // 创建菜单对象 231 | - (ArrowheadMenuSelectedState *)selectMenu { 232 | if(!_selectMenu) { 233 | _selectMenu = [[ArrowheadMenuSelectedState alloc] initCustomArrowheadStatusMenuWithNormalTitle:@[@"监控点", @"RFID点", @"水位测点", @"水质测点", @"巡检", @"GPS路径", @"巡检路径"] selectedTitle:@[@"监控点", @"RFID点", @"水位测点", @"水质测点", @"巡检", @"GPS路径", @"巡检路径"] normalIcon:@[@"ListMonitor", @"ListRFID", @"ListWaterLevel", @"ListWaterQuality", @"ListInspection", @"ListGPS", @"ListInspectionPath"] selectedIcon:@[@"ListMonitor", @"ListRFID", @"ListWaterLevel", @"ListWaterQuality", @"ListInspection", @"ListGPS", @"ListInspectionPath"] menuNormalTitleColorArray:@[RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1), RGBACOLOR(101, 100, 100, 1)] menuSelectedTitleColorArray:@[RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1), RGBACOLOR(0, 160, 241, 1)] menuUnitSize:CGSizeMake([UIScreen mainScreen].bounds.size.width/3+5, 38) menuFont:[UIFont fontWithName:@"Helvetica" size:15.f] menuBackColor:RGBACOLOR(248, 247, 242, 0.8) menuSegmentingLineColor:RGBACOLOR(215, 215, 215, 1) distanceFromTriggerSwitch:-5 menuArrowStyle:MenuArrowStyleRound menuPlacements:ShowAtBottom showAnimationEffects:ShowAnimationZoom]; 234 | 235 | _selectMenu.delegate = self; 236 | _selectMenu.allowsMultipleSelection = YES; 237 | } 238 | 239 | return _selectMenu; 240 | } 241 | 242 | // 菜单展示 243 | - (void)clickSelectMenu:(UIBarButtonItem *)sender { 244 | [self.selectMenu presentMenuView:sender]; 245 | } 246 | 247 | // 协议实现 248 | #pragma mark- 菜单代理方法 249 | - (void)menu:(BaseMenuViewController *)menu didClickedMenuItemUnitWithTag:(NSInteger)tag andItemUnitTitle:(NSString *)title itemiUnitPostClickState:(BOOL)state { 250 | 251 | if (menu == self.singleMenu) { 252 | NSLog(@"单选菜单"); 253 | } else if (menu == self.selectMenu) { 254 | NSLog(@"多选菜单"); 255 | } 256 | 257 | NSLog(@"%ld---%@---%d", tag, title, state); 258 | 259 | } 260 | ``` 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | -------------------------------------------------------------------------------- /Pop-upMenu/XYMenu/ArrowheadMenu.m: -------------------------------------------------------------------------------- 1 | // 2 | // ArrowheadMenu.m 3 | // 弹窗菜单 4 | // 5 | // Created by EastSun on 2017/12/21. 6 | // Copyright © 2017年 EastSun. All rights reserved. 7 | // 8 | 9 | #import "ArrowheadMenu.h" 10 | 11 | @interface ArrowheadMenu () 12 | 13 | /** 14 | 菜单背景图 15 | */ 16 | @property (nonatomic, strong, ) UIView *menuBackView; 17 | 18 | /** 19 | 菜单项 20 | */ 21 | @property (nonatomic, strong) UITableView *menuTableView; 22 | 23 | /** 24 | 标题数组 25 | */ 26 | @property (nonatomic, strong) NSArray *titleArray; 27 | 28 | /** 29 | 图表数组 30 | */ 31 | @property (nonatomic, strong) NSArray *iconArray; 32 | 33 | /** 34 | 开始位置 35 | */ 36 | @property (nonatomic, assign) CGRect startFrame; 37 | 38 | /** 39 | 菜单的位置 40 | */ 41 | @property (nonatomic, assign) CGRect menuRect; 42 | 43 | /** 44 | 菜单项目的位置 45 | */ 46 | @property (nonatomic, assign) CGRect menuItemRect; 47 | 48 | /** 49 | 箭头开始的点 50 | */ 51 | @property (nonatomic, assign) CGPoint arrowStartPoint; 52 | 53 | /** 54 | 菜单字体 55 | */ 56 | @property (nonatomic, strong) UIFont *font; 57 | 58 | /** 59 | 菜单字体颜色 60 | */ 61 | @property (nonatomic, strong) UIColor *fontColor; 62 | 63 | /** 64 | 菜单背景颜色 65 | */ 66 | @property (nonatomic, strong) UIColor *menuBackColor; 67 | 68 | /** 69 | 菜单分割线的颜色 70 | */ 71 | @property (nonatomic, strong) UIColor *separatorColor; 72 | 73 | /** 74 | 菜单和触发按钮的间隔 75 | */ 76 | @property (nonatomic, assign) CGFloat interval; 77 | 78 | /** 79 | 菜单项目单元格高度 80 | */ 81 | @property (nonatomic, assign) CGFloat cellHeight; 82 | 83 | /** 84 | 菜单宽度 85 | */ 86 | @property (nonatomic, assign) CGFloat menuWidth; 87 | 88 | /** 89 | 菜单高度 90 | */ 91 | @property (nonatomic, assign) CGFloat menuHeight; 92 | 93 | /** 94 | 菜单项目高度 95 | */ 96 | @property (nonatomic, assign) CGFloat menuItemHeight; 97 | 98 | /** 99 | 菜单项目宽度 100 | */ 101 | @property (nonatomic, assign) CGFloat menuItemWidth; 102 | 103 | /** 104 | 展示动画风格 105 | */ 106 | @property (nonatomic, assign) MenuShowAnimationStyle animationStyle; 107 | 108 | /** 109 | 位置 110 | */ 111 | @property (nonatomic, assign) MenuPlacements placements; 112 | 113 | /** 114 | 箭头风格 115 | */ 116 | @property (nonatomic, assign) MenuArrowStyle arrowStyle; 117 | 118 | /** 119 | 动画锚点 120 | */ 121 | @property (nonatomic, assign) CGPoint anchorPoint; 122 | 123 | 124 | @end 125 | 126 | @implementation ArrowheadMenu 127 | 128 | #pragma mark- 默认风格创建菜单 129 | - (instancetype)initDefaultArrowheadMenuWithTitle:(NSArray *)titleArray icon:(NSArray *)iconArray menuPlacements:(MenuPlacements)placements { 130 | 131 | return [self initCustomArrowheadMenuWithTitle:titleArray icon:iconArray menuUnitSize:CGSizeMake([UIScreen mainScreen].bounds.size.width/3, 38) menuFont:[UIFont fontWithName:@"Helvetica" size:15.f] menuFontColor:[UIColor whiteColor] menuBackColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0.8] menuSegmentingLineColor:[UIColor colorWithRed:192/255.f green:196/255.f blue:201/255.f alpha:1] distanceFromTriggerSwitch:0 menuArrowStyle:MenuArrowStyleTriangle menuPlacements:placements showAnimationEffects:ShowAnimationZoom]; 132 | } 133 | 134 | #pragma mark- 自定义风格创建菜单 135 | - (instancetype)initCustomArrowheadMenuWithTitle:(NSArray *)titleArray icon:(NSArray *)iconArray menuUnitSize:(CGSize)size menuFont:(UIFont *)font menuFontColor:(UIColor *)fontColor menuBackColor:(UIColor *)menuBackColor menuSegmentingLineColor:(UIColor *)separatorColor distanceFromTriggerSwitch:(CGFloat)interval menuArrowStyle:(MenuArrowStyle)arrowStyle menuPlacements:(MenuPlacements)placements showAnimationEffects:(MenuShowAnimationStyle)animation { 136 | 137 | self = [super init]; 138 | if (self) { 139 | 140 | self.font = font;// 菜单字体 141 | self.separatorColor = separatorColor;// 分割线颜色 142 | self.menuBackColor = menuBackColor;// 菜单背景颜色 143 | self.fontColor = fontColor;// 字体颜色和背景颜色形成对比 144 | self.cellHeight = size.height;// 菜单单元格高度 145 | self.menuItemWidth = size.width;// 菜单项目宽度 146 | self.menuItemHeight = size.height*titleArray.count;// 菜单项目高度 147 | self.interval = interval;// 菜单和触发按钮的间隔 148 | self.titleArray = titleArray;// 标题 149 | self.iconArray = iconArray;// 图标 150 | self.arrowStyle = arrowStyle;// 箭头风格 151 | self.placements = placements;// 展示位置 152 | self.animationStyle = animation; // 展示动画 153 | } 154 | 155 | return self; 156 | 157 | } 158 | 159 | #pragma mark- 菜单位置和大小计算,并跟新菜单frame 160 | - (void)calculateMenuPositionAccordingTo:(NSObject *)tSwitch menuPlacements:(MenuPlacements)placementsStyle { 161 | // 1、将开关的frame转换绝对坐标 162 | [self calculateSwitchPosition:tSwitch]; 163 | 164 | // 2、计算菜单的位置 165 | switch (placementsStyle) { 166 | case 0:// 菜单在触发按钮上部显示 167 | { 168 | self.menuWidth = self.menuItemWidth;// 菜单宽度 169 | self.menuHeight = self.menuItemHeight + ARROWHEIGHT;// 菜单高度 170 | CGFloat centerX = self.startFrame.origin.x+self.startFrame.size.width/2;// 按钮水平方向中心点 171 | // 判断触发按钮位置 172 | if ( centerX - self.menuWidth/2 <0) {// 触发按钮太靠左了。 173 | self.menuRect = CGRectMake(ARROWHEIGHT, CGRectGetMinY(self.startFrame) - (self.menuHeight+self.interval), self.menuWidth, self.menuHeight); 174 | 175 | } else if ( centerX + self.menuWidth/2 > [UIScreen mainScreen].bounds.size.width) {// 触发按钮太靠右了 176 | self.menuRect = CGRectMake([UIScreen mainScreen].bounds.size.width - ARROWHEIGHT - self.menuWidth, CGRectGetMinY(self.startFrame) - (self.menuHeight+self.interval), self.menuWidth, self.menuHeight); 177 | 178 | } else { 179 | self.menuRect = CGRectMake(centerX - self.menuWidth/2, CGRectGetMinY(self.startFrame) - (self.menuHeight+self.interval), self.menuWidth, self.menuHeight); 180 | } 181 | 182 | self.arrowStartPoint = CGPointMake(centerX - self.menuRect.origin.x, self.menuHeight); 183 | 184 | self.menuItemRect = CGRectMake(0, 0, self.menuItemWidth, self.menuItemHeight); 185 | 186 | self.menuBackView.frame = self.menuRect; 187 | self.anchorPoint = CGPointMake(self.arrowStartPoint.x/self.menuWidth, 1.f);// 动画开始时的锚点 188 | 189 | switch (self.arrowStyle) { 190 | case 0:// 圆角箭头 191 | { 192 | [self.menuBackView getBottomRoundedArrowWitharrowHeight:ARROWHEIGHT radianRadius:MENUCORNERRADIUS startPoint:self.arrowStartPoint]; 193 | } 194 | break; 195 | case 1:// 尖角箭头 196 | { 197 | [self.menuBackView getBottomArrowWitharrowHeight:ARROWHEIGHT radianRadius:MENUCORNERRADIUS startPoint:self.arrowStartPoint]; 198 | } 199 | break; 200 | 201 | } 202 | 203 | } 204 | break; 205 | case 1:// 菜单在触发按钮左侧显示 206 | { 207 | self.menuWidth = self.menuItemWidth+ARROWHEIGHT;// 菜单宽度 208 | self.menuHeight = self.menuItemHeight;// 菜单高度 209 | CGFloat centerY = self.startFrame.origin.y+self.startFrame.size.height/2;// 按钮水平方向中心点 210 | // 判断触发按钮位置 211 | if ( centerY - self.menuHeight/2 <0) {// 触发按钮太靠上了。 212 | self.menuRect = CGRectMake(self.startFrame.origin.x-(self.menuWidth+self.interval), 0, self.menuWidth, self.menuHeight); 213 | 214 | } else if ( centerY + self.menuWidth/2 > [UIScreen mainScreen].bounds.size.width) {// 触发按钮太靠下了 215 | self.menuRect = CGRectMake(self.startFrame.origin.x-(self.menuWidth+self.interval), [UIScreen mainScreen].bounds.size.height - self.menuHeight, self.menuWidth, self.menuHeight); 216 | 217 | } else { 218 | self.menuRect = CGRectMake(self.startFrame.origin.x-(self.menuWidth+self.interval), centerY - self.menuHeight/2, self.menuWidth, self.menuHeight); 219 | } 220 | 221 | self.arrowStartPoint = CGPointMake(self.menuWidth, centerY-self.menuRect.origin.y); 222 | 223 | self.menuItemRect = CGRectMake(0, 0, self.menuItemWidth, self.menuItemHeight); 224 | 225 | self.menuBackView.frame = self.menuRect; 226 | self.anchorPoint = CGPointMake(1.f, self.arrowStartPoint.y/self.menuHeight);// 动画开始时的锚点 227 | 228 | [self.menuBackView getRightArrowWitharrowHeight:ARROWHEIGHT radianRadius:MENUCORNERRADIUS startPoint:self.arrowStartPoint]; 229 | 230 | } 231 | break; 232 | case 2:// 菜单在触发按钮底部显示 233 | { 234 | self.menuWidth = self.menuItemWidth;// 菜单宽度 235 | self.menuHeight = self.menuItemHeight + ARROWHEIGHT;// 菜单高度 236 | CGFloat centerX = self.startFrame.origin.x+self.startFrame.size.width/2;// 按钮水平方向中心点 237 | // 判断触发按钮位置 238 | if ( centerX - self.menuWidth/2 <0) {// 触发按钮太靠左了。 239 | self.menuRect = CGRectMake(ARROWHEIGHT, CGRectGetMaxY(self.startFrame)+self.interval, self.menuWidth, self.menuHeight); 240 | 241 | } else if ( centerX + self.menuWidth/2 > [UIScreen mainScreen].bounds.size.width) {// 触发按钮太靠右了 242 | self.menuRect = CGRectMake([UIScreen mainScreen].bounds.size.width - ARROWHEIGHT - self.menuWidth, CGRectGetMaxY(self.startFrame)+self.interval, self.menuWidth, self.menuHeight); 243 | 244 | } else { 245 | self.menuRect = CGRectMake(centerX - self.menuWidth/2, CGRectGetMaxY(self.startFrame)+self.interval, self.menuWidth, self.menuHeight); 246 | } 247 | 248 | self.arrowStartPoint = CGPointMake(centerX - self.menuRect.origin.x, 0); 249 | 250 | self.menuItemRect = CGRectMake(0, ARROWHEIGHT, self.menuItemWidth, self.menuItemHeight); 251 | 252 | self.menuBackView.frame = self.menuRect; 253 | self.anchorPoint = CGPointMake(self.arrowStartPoint.x/self.menuWidth, 0.f);// 动画开始时的锚点 254 | 255 | switch (self.arrowStyle) { 256 | case 0:// 圆角箭头 257 | { 258 | [self.menuBackView getTopRoundedArrowWitharrowHeight:ARROWHEIGHT radianRadius:MENUCORNERRADIUS startPoint:self.arrowStartPoint]; 259 | } 260 | break; 261 | case 1:// 尖角箭头 262 | { 263 | [self.menuBackView getTopArrowWitharrowHeight:ARROWHEIGHT radianRadius:MENUCORNERRADIUS startPoint:self.arrowStartPoint]; 264 | } 265 | break; 266 | 267 | } 268 | } 269 | break; 270 | case 3:// 菜单在触发按钮右侧显示 271 | { 272 | self.menuWidth = self.menuItemWidth+ARROWHEIGHT;// 菜单宽度 273 | self.menuHeight = self.menuItemHeight;// 菜单高度 274 | CGFloat centerY = self.startFrame.origin.y+self.startFrame.size.height/2;// 按钮水平方向中心点 275 | // 判断触发按钮位置 276 | if ( centerY - self.menuHeight/2 <0) {// 触发按钮太靠上了。 277 | self.menuRect = CGRectMake(CGRectGetMaxX(self.startFrame)+self.interval, 0, self.menuWidth, self.menuHeight); 278 | 279 | } else if ( centerY + self.menuWidth/2 > [UIScreen mainScreen].bounds.size.width) {// 触发按钮太靠下了 280 | self.menuRect = CGRectMake(CGRectGetMaxX(self.startFrame)+self.interval, [UIScreen mainScreen].bounds.size.height - self.menuHeight, self.menuWidth, self.menuHeight); 281 | 282 | } else { 283 | self.menuRect = CGRectMake(CGRectGetMaxX(self.startFrame)+self.interval, centerY - self.menuHeight/2, self.menuWidth, self.menuHeight); 284 | } 285 | 286 | self.arrowStartPoint = CGPointMake(0, centerY-self.menuRect.origin.y); 287 | self.menuItemRect = CGRectMake(ARROWHEIGHT, 0, self.menuItemWidth, self.menuItemHeight); 288 | 289 | self.menuBackView.frame = self.menuRect; 290 | self.anchorPoint = CGPointMake(0.f, self.arrowStartPoint.y/self.menuHeight);// 动画开始时的锚点 291 | 292 | [self.menuBackView getLeftArrowWitharrowHeight:ARROWHEIGHT radianRadius:MENUCORNERRADIUS startPoint:self.arrowStartPoint]; 293 | 294 | } 295 | break; 296 | } 297 | } 298 | 299 | #pragma mark- 绝对坐标转换 300 | - (void)calculateSwitchPosition:(NSObject *)tSwitch { 301 | UIView *view; 302 | if ([tSwitch isKindOfClass:[UIView class]]) {// 是view类,转换成绝对坐标 303 | view = (UIView *)tSwitch; 304 | } else if ([tSwitch isKindOfClass:[UIBarItem class]]) {// 导航栏或标签按钮 305 | view = [tSwitch valueForKey:@"view"]; 306 | } 307 | UIWindow *window = [UIApplication sharedApplication].keyWindow; 308 | self.startFrame = [view convertRect:view.bounds toView:window];// 转成相对于self.view的绝对坐标,因为传过来的控件不一定是self.view的直接子视图 309 | } 310 | 311 | #pragma mark- 弹出方法 312 | - (void)presentMenuView:(NSObject *)sender { 313 | // 1、根据触发控件sender的位置,计算菜单的位置 314 | [self calculateMenuPositionAccordingTo:sender menuPlacements:self.placements]; 315 | // 2、展示菜单 316 | [self presentMenuView]; 317 | } 318 | 319 | #pragma mark- 移除菜单 320 | - (void)removeMenuView { 321 | 322 | // 根据动画风格移除菜单 323 | switch (self.animationStyle) { 324 | case 0:// 无动画效果 325 | { 326 | [self.menuBackView removeFromSuperview]; 327 | [self dismissViewControllerAnimated:NO completion:nil]; 328 | } 329 | break; 330 | 331 | case 1:// 缩放效果 332 | { 333 | [UIView animateWithDuration:0.25f animations:^{ 334 | self.menuBackView.transform = CGAffineTransformMakeScale(0.6f, 0.6f); 335 | [self dismissViewControllerAnimated:NO completion:nil]; 336 | } completion:^(BOOL finished) { 337 | [self.menuBackView removeFromSuperview]; 338 | self.menuBackView.transform = CGAffineTransformIdentity;// 还原回来,否则会影响下次弹出 339 | }]; 340 | } 341 | break; 342 | } 343 | } 344 | 345 | #pragma mark- 定制并展示菜单 346 | - (void)viewWillAppear:(BOOL)animated { 347 | [super viewWillAppear:animated]; 348 | 349 | // 1、设置菜单遮罩层颜色 350 | self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0]; 351 | 352 | // 2、根据动画风格展示菜单 353 | switch (self.animationStyle) { 354 | case 0:// 无动画效果 355 | { 356 | [self.view addSubview:self.menuBackView]; 357 | } 358 | break; 359 | 360 | case 1:// 缩放效果 361 | { 362 | self.menuBackView.layer.anchorPoint = self.anchorPoint; 363 | self.menuBackView.frame = self.menuRect;// 设置锚点后,会影响frme的origin,所以需要重新赋值 364 | self.menuBackView.transform = CGAffineTransformMakeScale(0.01f, 0.01f); 365 | [UIView animateWithDuration:0.25f animations:^{ 366 | [self.view addSubview:self.menuBackView]; 367 | self.menuBackView.transform = CGAffineTransformIdentity; 368 | }]; 369 | } 370 | break; 371 | } 372 | 373 | } 374 | 375 | #pragma mark- 菜单TableView代理方法 376 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 377 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 378 | 379 | // 1、通知代理处理点击事件 380 | if ([self.delegate respondsToSelector:@selector(menu:didClickedItemUnitWithTag:andItemUnitTitle:)]) { 381 | [self.delegate menu:self didClickedItemUnitWithTag:indexPath.row andItemUnitTitle:self.titleArray[indexPath.row]]; 382 | } 383 | // 2、移除菜单 384 | [self removeMenuView]; 385 | } 386 | 387 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 388 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"%lu-+%lu", indexPath.row, indexPath.section]]; 389 | if (!cell) { 390 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[NSString stringWithFormat:@"%lu-+%lu", indexPath.row, indexPath.section]]; 391 | // 设置标题格式 392 | cell.textLabel.textColor = self.fontColor; 393 | cell.textLabel.font = self.font; 394 | cell.backgroundColor = [UIColor clearColor]; 395 | // 设置菜单点击背景 396 | cell.selectedBackgroundView = [[UIView alloc] initWithFrame:cell.frame]; 397 | cell.selectedBackgroundView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.4]; 398 | // 移除最后一个cell的分割线 399 | if (indexPath.row == [tableView numberOfRowsInSection:indexPath.section]-1) { 400 | 401 | cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, cell.bounds.size.width); 402 | } 403 | 404 | // 设置菜单图标 405 | if (self.iconArray) { 406 | cell.imageView.image = [UIImage imageNamed:self.iconArray[indexPath.row]]; 407 | cell.textLabel.textAlignment = NSTextAlignmentLeft; 408 | } else { 409 | cell.textLabel.textAlignment = NSTextAlignmentCenter; 410 | } 411 | // 设置菜单标题 412 | cell.textLabel.text = self.titleArray[indexPath.row]; 413 | 414 | } 415 | 416 | 417 | return cell; 418 | } 419 | 420 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 421 | return self.cellHeight; 422 | } 423 | 424 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 425 | return self.titleArray.count; 426 | } 427 | 428 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 429 | return 1; 430 | } 431 | 432 | #pragma mark- 控件懒加载 433 | - (UIView *)menuBackView { 434 | if (!_menuBackView) { 435 | _menuBackView = [[UIView alloc] init]; 436 | _menuBackView.backgroundColor = self.menuBackColor; 437 | // 添加菜单项 438 | [_menuBackView addSubview:self.menuTableView]; 439 | } 440 | 441 | return _menuBackView; 442 | } 443 | 444 | - (UITableView *)menuTableView { 445 | 446 | if (!_menuTableView) { 447 | _menuTableView = [[UITableView alloc] initWithFrame:self.menuItemRect style:UITableViewStylePlain]; 448 | _menuTableView.dataSource = self; 449 | _menuTableView.delegate = self; 450 | _menuTableView.bounces = NO; 451 | _menuTableView.showsVerticalScrollIndicator = NO; 452 | _menuTableView.tableFooterView = [[UIView alloc] init]; 453 | _menuTableView.backgroundColor = [UIColor clearColor]; 454 | 455 | // 分割线颜色 456 | _menuTableView.separatorColor = self.separatorColor; 457 | // 调整cell的分割线的位置 458 | _menuTableView.separatorInset = UIEdgeInsetsMake(0, 10, 0, 10); 459 | 460 | _menuTableView.layoutMargins = UIEdgeInsetsMake(0, 10, 0, 10); 461 | } 462 | 463 | return _menuTableView; 464 | } 465 | 466 | - (void)viewDidLoad { 467 | [super viewDidLoad]; 468 | // Do any additional setup after loading the view. 469 | } 470 | 471 | - (void)didReceiveMemoryWarning { 472 | [super didReceiveMemoryWarning]; 473 | // Dispose of any resources that can be recreated. 474 | } 475 | 476 | @end 477 | -------------------------------------------------------------------------------- /Pop-upMenu/XYMenu/UIView+DrawGraphics.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | // 4 | // UIView+DrawGraphics.m 5 | // 贝塞尔曲线绘图 6 | // 7 | // Created by EastSun on 2017/12/20. 8 | // Copyright © 2017年 EastSun. All rights reserved. 9 | // 10 | 11 | #import "UIView+DrawGraphics.h" 12 | 13 | #define SELFWIDTH CGRectGetWidth(self.frame) 14 | #define SELFHEIGHT CGRectGetHeight(self.frame) 15 | 16 | @implementation UIView (DrawGraphics) 17 | 18 | - (void)getTopRoundedArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius startPoint:(CGPoint)startPoint { 19 | 20 | UIBezierPath *path = [UIBezierPath bezierPath]; 21 | 22 | CGFloat filletRadius = 3;// 圆角半径 23 | 24 | // 顺时针设置三角圆弧 25 | [path addArcWithCenter:CGPointMake(startPoint.x, startPoint.y + filletRadius) radius:filletRadius startAngle:M_PI endAngle:0 clockwise:YES]; 26 | 27 | 28 | [path addLineToPoint:CGPointMake(startPoint.x+arrowHeight, startPoint.y+arrowHeight)];// 和在左侧化箭头刚好颠倒过来 29 | 30 | [path addLineToPoint:CGPointMake(SELFWIDTH - radianRadius,startPoint.y+arrowHeight)]; 31 | 32 | // 第一个参数是目的点,第二个参数是控制画弧线的第一个控制点,第三个参数是控制画弧线的第二个控制点 33 | [path addCurveToPoint:CGPointMake(SELFWIDTH,startPoint.y+arrowHeight+radianRadius) controlPoint1:CGPointMake(SELFWIDTH - radianRadius,startPoint.y+arrowHeight) controlPoint2:CGPointMake(SELFWIDTH, startPoint.y+arrowHeight)];// 添加第一段弧线 34 | 35 | [path addLineToPoint:CGPointMake(SELFWIDTH, SELFHEIGHT - radianRadius)]; 36 | 37 | [path addCurveToPoint:CGPointMake(SELFWIDTH - radianRadius, SELFHEIGHT) controlPoint1:CGPointMake(SELFWIDTH, SELFHEIGHT - radianRadius) controlPoint2:CGPointMake(SELFWIDTH, SELFHEIGHT)];// 添加弧线 38 | 39 | [path addLineToPoint:CGPointMake(radianRadius, SELFHEIGHT)]; 40 | 41 | [path addCurveToPoint:CGPointMake(0, SELFHEIGHT-radianRadius) controlPoint1:CGPointMake(radianRadius, SELFHEIGHT) controlPoint2:CGPointMake(0, SELFHEIGHT)];// 添加弧线 42 | 43 | [path addLineToPoint:CGPointMake(0, startPoint.y+arrowHeight+radianRadius)]; 44 | 45 | [path addCurveToPoint:CGPointMake(radianRadius, startPoint.y+arrowHeight) controlPoint1:CGPointMake(0, startPoint.y+arrowHeight+radianRadius) controlPoint2:CGPointMake(0, startPoint.y+arrowHeight)];// 添加弧线 46 | 47 | [path addLineToPoint:CGPointMake(startPoint.x - arrowHeight, startPoint.y+arrowHeight)]; 48 | 49 | 50 | // [path addLineToPoint:CGPointMake(startPoint.x, startPoint.y)]; 51 | [path addLineToPoint:CGPointMake(startPoint.x - filletRadius, startPoint.y +filletRadius)]; 52 | 53 | CAShapeLayer *pathLayer = [CAShapeLayer layer]; 54 | pathLayer.path = path.CGPath; 55 | pathLayer.lineWidth = 0; 56 | pathLayer.strokeColor = [UIColor whiteColor].CGColor; 57 | pathLayer.fillColor = [UIColor whiteColor].CGColor; 58 | 59 | self.layer.mask = pathLayer; 60 | 61 | } 62 | 63 | - (void)getBottomRoundedArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius startPoint:(CGPoint)startPoint { 64 | 65 | UIBezierPath *path = [UIBezierPath bezierPath]; 66 | 67 | CGFloat filletRadius = 3;// 圆角半径 68 | 69 | // 顺时针设置三角圆弧 70 | [path addArcWithCenter:CGPointMake(startPoint.x, startPoint.y - filletRadius) radius:filletRadius startAngle:0 endAngle:M_PI clockwise:YES]; 71 | 72 | 73 | [path addLineToPoint:CGPointMake(startPoint.x-arrowHeight, startPoint.y-arrowHeight)];// 和在左侧化箭头刚好颠倒过来 74 | 75 | [path addLineToPoint:CGPointMake(radianRadius,startPoint.y-arrowHeight)]; 76 | 77 | // 第一个参数是目的点,第二个参数是控制画弧线的第一个控制点,第三个参数是控制画弧线的第二个控制点 78 | [path addCurveToPoint:CGPointMake(0, startPoint.y-(arrowHeight+radianRadius)) controlPoint1:CGPointMake(radianRadius,startPoint.y-arrowHeight) controlPoint2:CGPointMake(0, startPoint.y-arrowHeight)];// 添加第一段弧线 79 | 80 | [path addLineToPoint:CGPointMake(0, radianRadius)]; 81 | 82 | [path addCurveToPoint:CGPointMake(radianRadius, 0) controlPoint1:CGPointMake(0, radianRadius) controlPoint2:CGPointMake(0, 0)];// 添加弧线 83 | 84 | [path addLineToPoint:CGPointMake(SELFWIDTH-radianRadius, 0)]; 85 | 86 | [path addCurveToPoint:CGPointMake(SELFWIDTH, radianRadius) controlPoint1:CGPointMake(SELFWIDTH-radianRadius, 0) controlPoint2:CGPointMake(SELFWIDTH, 0)];// 添加弧线 87 | 88 | [path addLineToPoint:CGPointMake(SELFWIDTH, startPoint.y-(arrowHeight+radianRadius))]; 89 | 90 | [path addCurveToPoint:CGPointMake(SELFWIDTH-radianRadius, startPoint.y-arrowHeight) controlPoint1:CGPointMake(SELFWIDTH, startPoint.y-(arrowHeight+radianRadius)) controlPoint2:CGPointMake(SELFWIDTH, startPoint.y-arrowHeight)];// 添加弧线 91 | 92 | [path addLineToPoint:CGPointMake(startPoint.x + arrowHeight, startPoint.y-arrowHeight)]; 93 | 94 | 95 | // [path addLineToPoint:CGPointMake(startPoint.x, startPoint.y)]; 96 | [path addLineToPoint:CGPointMake(startPoint.x + filletRadius, startPoint.y -filletRadius)]; 97 | 98 | CAShapeLayer *pathLayer = [CAShapeLayer layer]; 99 | pathLayer.path = path.CGPath; 100 | pathLayer.lineWidth = 0; 101 | pathLayer.strokeColor = [UIColor whiteColor].CGColor; 102 | pathLayer.fillColor = [UIColor whiteColor].CGColor; 103 | 104 | self.layer.mask = pathLayer; 105 | } 106 | 107 | - (void)getTopArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius startPoint:(CGPoint)startPoint { 108 | UIBezierPath *path = [UIBezierPath bezierPath]; 109 | 110 | [path moveToPoint:CGPointMake(startPoint.x, startPoint.y)];// 上下画箭头,起点是(宽的一半,0/高);左右画箭头,起点是(0/宽,高的一半) 111 | 112 | [path addLineToPoint:CGPointMake(startPoint.x+arrowHeight*atanh(M_PI/6), startPoint.y+arrowHeight)];// 和在左侧化箭头刚好颠倒过来 113 | 114 | [path addLineToPoint:CGPointMake(SELFWIDTH - radianRadius,startPoint.y+arrowHeight)]; 115 | 116 | // 第一个参数是目的点,第二个参数是控制画弧线的第一个控制点,第三个参数是控制画弧线的第二个控制点 117 | [path addCurveToPoint:CGPointMake(SELFWIDTH,startPoint.y+arrowHeight+radianRadius) controlPoint1:CGPointMake(SELFWIDTH - radianRadius,startPoint.y+arrowHeight) controlPoint2:CGPointMake(SELFWIDTH, startPoint.y+arrowHeight)];// 添加第一段弧线 118 | 119 | [path addLineToPoint:CGPointMake(SELFWIDTH, SELFHEIGHT - radianRadius)]; 120 | 121 | [path addCurveToPoint:CGPointMake(SELFWIDTH - radianRadius, SELFHEIGHT) controlPoint1:CGPointMake(SELFWIDTH, SELFHEIGHT - radianRadius) controlPoint2:CGPointMake(SELFWIDTH, SELFHEIGHT)];// 添加弧线 122 | 123 | [path addLineToPoint:CGPointMake(radianRadius, SELFHEIGHT)]; 124 | 125 | [path addCurveToPoint:CGPointMake(0, SELFHEIGHT-radianRadius) controlPoint1:CGPointMake(radianRadius, SELFHEIGHT) controlPoint2:CGPointMake(0, SELFHEIGHT)];// 添加弧线 126 | 127 | [path addLineToPoint:CGPointMake(0, startPoint.y+arrowHeight+radianRadius)]; 128 | 129 | [path addCurveToPoint:CGPointMake(radianRadius, startPoint.y+arrowHeight) controlPoint1:CGPointMake(0, startPoint.y+arrowHeight+radianRadius) controlPoint2:CGPointMake(0, startPoint.y+arrowHeight)];// 添加弧线 130 | 131 | [path addLineToPoint:CGPointMake(startPoint.x - arrowHeight*atanh(M_PI/6), startPoint.y+arrowHeight)]; 132 | [path addLineToPoint:CGPointMake(startPoint.x, startPoint.y)]; 133 | 134 | CAShapeLayer *pathLayer = [CAShapeLayer layer]; 135 | pathLayer.path = path.CGPath; 136 | pathLayer.lineWidth = 0; 137 | pathLayer.strokeColor = [UIColor whiteColor].CGColor; 138 | pathLayer.fillColor = [UIColor whiteColor].CGColor; 139 | 140 | self.layer.mask = pathLayer; 141 | } 142 | 143 | - (void)getBottomArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius startPoint:(CGPoint)startPoint { 144 | 145 | UIBezierPath *path = [UIBezierPath bezierPath]; 146 | 147 | [path moveToPoint:CGPointMake(startPoint.x, startPoint.y)];// 上下画箭头,起点是(宽的一半,0/高);左右画箭头,起点是(0/宽,高的一半) 148 | 149 | [path addLineToPoint:CGPointMake(startPoint.x-arrowHeight*atanh(M_PI/6), startPoint.y-arrowHeight)];// 和在左侧化箭头刚好颠倒过来 150 | 151 | [path addLineToPoint:CGPointMake(radianRadius,startPoint.y-arrowHeight)]; 152 | 153 | // 第一个参数是目的点,第二个参数是控制画弧线的第一个控制点,第三个参数是控制画弧线的第二个控制点 154 | [path addCurveToPoint:CGPointMake(0, startPoint.y-(arrowHeight+radianRadius)) controlPoint1:CGPointMake(radianRadius,startPoint.y-arrowHeight) controlPoint2:CGPointMake(0, startPoint.y-arrowHeight)];// 添加第一段弧线 155 | 156 | [path addLineToPoint:CGPointMake(0, radianRadius)]; 157 | 158 | [path addCurveToPoint:CGPointMake(radianRadius, 0) controlPoint1:CGPointMake(0, radianRadius) controlPoint2:CGPointMake(0, 0)];// 添加弧线 159 | 160 | [path addLineToPoint:CGPointMake(SELFWIDTH-radianRadius, 0)]; 161 | 162 | [path addCurveToPoint:CGPointMake(SELFWIDTH, radianRadius) controlPoint1:CGPointMake(SELFWIDTH-radianRadius, 0) controlPoint2:CGPointMake(SELFWIDTH, 0)];// 添加弧线 163 | 164 | [path addLineToPoint:CGPointMake(SELFWIDTH, startPoint.y-(arrowHeight+radianRadius))]; 165 | 166 | [path addCurveToPoint:CGPointMake(SELFWIDTH-radianRadius, startPoint.y-arrowHeight) controlPoint1:CGPointMake(SELFWIDTH, startPoint.y-(arrowHeight+radianRadius)) controlPoint2:CGPointMake(SELFWIDTH, startPoint.y-arrowHeight)];// 添加弧线 167 | 168 | [path addLineToPoint:CGPointMake(startPoint.x + arrowHeight*atanh(M_PI/6), startPoint.y-arrowHeight)]; 169 | [path addLineToPoint:CGPointMake(startPoint.x, startPoint.y)]; 170 | 171 | CAShapeLayer *pathLayer = [CAShapeLayer layer]; 172 | pathLayer.path = path.CGPath; 173 | pathLayer.lineWidth = 0; 174 | pathLayer.strokeColor = [UIColor whiteColor].CGColor; 175 | pathLayer.fillColor = [UIColor whiteColor].CGColor; 176 | 177 | self.layer.mask = pathLayer; 178 | } 179 | 180 | - (void)getLeftArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius startPoint:(CGPoint)startPoint { 181 | 182 | UIBezierPath *path = [UIBezierPath bezierPath]; 183 | [path moveToPoint:CGPointMake(startPoint.x, startPoint.y)]; 184 | [path addLineToPoint:CGPointMake(startPoint.x+arrowHeight, startPoint.y-arrowHeight*atanh(M_PI/6))]; 185 | [path addLineToPoint:CGPointMake(startPoint.x+arrowHeight, radianRadius)]; 186 | 187 | // 第一个参数是目的点,第二个参数是控制画弧线的第一个控制点,第三个参数是控制画弧线的第二个控制点 188 | [path addCurveToPoint:CGPointMake(startPoint.x+arrowHeight+radianRadius, 0) controlPoint1:CGPointMake(startPoint.x+arrowHeight, radianRadius) controlPoint2:CGPointMake(startPoint.x+arrowHeight, 0)];// 添加第一段弧线 189 | 190 | [path addLineToPoint:CGPointMake(SELFWIDTH - radianRadius, 0)]; 191 | 192 | [path addCurveToPoint:CGPointMake(SELFWIDTH, radianRadius) controlPoint1:CGPointMake(SELFWIDTH - radianRadius, 0) controlPoint2:CGPointMake(SELFWIDTH, 0)];// 添加弧线 193 | 194 | [path addLineToPoint:CGPointMake(SELFWIDTH, SELFHEIGHT-radianRadius)]; 195 | 196 | [path addCurveToPoint:CGPointMake(SELFWIDTH - radianRadius, SELFHEIGHT) controlPoint1:CGPointMake(SELFWIDTH, SELFHEIGHT-radianRadius) controlPoint2:CGPointMake(SELFWIDTH, SELFHEIGHT)];// 添加弧线 197 | 198 | [path addLineToPoint:CGPointMake(startPoint.x+arrowHeight+radianRadius, SELFHEIGHT)]; 199 | 200 | [path addCurveToPoint:CGPointMake(startPoint.x+arrowHeight, SELFHEIGHT-radianRadius) controlPoint1:CGPointMake(startPoint.x+arrowHeight+radianRadius, SELFHEIGHT) controlPoint2:CGPointMake(startPoint.x+arrowHeight, SELFHEIGHT)];// 添加弧线 201 | [path addLineToPoint:CGPointMake(startPoint.x+arrowHeight, startPoint.y+arrowHeight*atanh(M_PI/6))]; 202 | [path addLineToPoint:CGPointMake(startPoint.x, startPoint.y)]; 203 | 204 | CAShapeLayer *pathLayer = [CAShapeLayer layer]; 205 | pathLayer.path = path.CGPath; 206 | pathLayer.lineWidth = 0; 207 | pathLayer.strokeColor = [UIColor whiteColor].CGColor; 208 | pathLayer.fillColor = [UIColor whiteColor].CGColor; 209 | 210 | self.layer.mask = pathLayer; 211 | 212 | } 213 | 214 | - (void)getRightArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius startPoint:(CGPoint)startPoint { 215 | 216 | UIBezierPath *path = [UIBezierPath bezierPath]; 217 | [path moveToPoint:CGPointMake(startPoint.x, startPoint.y)]; 218 | 219 | [path addLineToPoint:CGPointMake(startPoint.x - arrowHeight, startPoint.y+arrowHeight*atanh(M_PI/6))]; 220 | 221 | [path addLineToPoint:CGPointMake(startPoint.x - arrowHeight, SELFHEIGHT-radianRadius)]; 222 | 223 | // 第一个参数是目的点,第二个参数是控制画弧线的第一个控制点,第三个参数是控制画弧线的第二个控制点 224 | [path addCurveToPoint:CGPointMake(startPoint.x-(arrowHeight+radianRadius), SELFHEIGHT) controlPoint1:CGPointMake(startPoint.x - arrowHeight, SELFHEIGHT-radianRadius) controlPoint2:CGPointMake(startPoint.x - arrowHeight, SELFHEIGHT)];// 添加第一段弧线 225 | 226 | [path addLineToPoint:CGPointMake(radianRadius, SELFHEIGHT)]; 227 | 228 | [path addCurveToPoint:CGPointMake(0, SELFHEIGHT-radianRadius) controlPoint1:CGPointMake(radianRadius, SELFHEIGHT) controlPoint2:CGPointMake(0, SELFHEIGHT)];// 添加弧线 229 | 230 | [path addLineToPoint:CGPointMake(0, radianRadius)]; 231 | 232 | [path addCurveToPoint:CGPointMake(radianRadius, 0) controlPoint1:CGPointMake(0, radianRadius) controlPoint2:CGPointMake(0, 0)];// 添加弧线 233 | 234 | [path addLineToPoint:CGPointMake(startPoint.x-(arrowHeight+radianRadius), 0)]; 235 | 236 | [path addCurveToPoint:CGPointMake(startPoint.x-arrowHeight, radianRadius) controlPoint1:CGPointMake(startPoint.x-(arrowHeight+radianRadius), 0) controlPoint2:CGPointMake(startPoint.x-arrowHeight, 0)];// 添加弧线 237 | 238 | [path addLineToPoint:CGPointMake(startPoint.x-arrowHeight, startPoint.y-arrowHeight*atanh(M_PI/6))]; 239 | 240 | [path addLineToPoint:CGPointMake(startPoint.x, startPoint.y)]; 241 | 242 | CAShapeLayer *pathLayer = [CAShapeLayer layer]; 243 | pathLayer.path = path.CGPath; 244 | pathLayer.lineWidth = 0; 245 | pathLayer.strokeColor = [UIColor whiteColor].CGColor; 246 | pathLayer.fillColor = [UIColor whiteColor].CGColor; 247 | 248 | self.layer.mask = pathLayer; 249 | 250 | } 251 | 252 | 253 | #pragma mark- 中间三角 254 | /** 255 | 绘制箭头 256 | 257 | @param arrowHeight 箭头的高度 258 | @param radianRadius 圆弧半径 259 | */ 260 | - (void)getTopArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius { 261 | 262 | UIBezierPath *path = [UIBezierPath bezierPath]; 263 | [path moveToPoint:CGPointMake(SELFWIDTH/2, 0)];// 上下画箭头,起点是(宽的一半,0/高);左右画箭头,起点是(0/宽,高的一半) 264 | 265 | [path addLineToPoint:CGPointMake(SELFWIDTH/2+arrowHeight*atanh(M_PI/6), arrowHeight)];// 和在左侧化箭头刚好颠倒过来 266 | 267 | [path addLineToPoint:CGPointMake(SELFWIDTH - radianRadius,arrowHeight)]; 268 | 269 | // 第一个参数是目的点,第二个参数是控制画弧线的第一个控制点,第三个参数是控制画弧线的第二个控制点 270 | [path addCurveToPoint:CGPointMake(SELFWIDTH, arrowHeight+radianRadius) controlPoint1:CGPointMake(SELFWIDTH - radianRadius,arrowHeight) controlPoint2:CGPointMake(SELFWIDTH, arrowHeight)];// 添加第一段弧线 271 | 272 | [path addLineToPoint:CGPointMake(SELFWIDTH, SELFHEIGHT - radianRadius)]; 273 | 274 | [path addCurveToPoint:CGPointMake(SELFWIDTH - radianRadius, SELFHEIGHT) controlPoint1:CGPointMake(SELFWIDTH, SELFHEIGHT - radianRadius) controlPoint2:CGPointMake(SELFWIDTH, SELFHEIGHT)];// 添加弧线 275 | 276 | [path addLineToPoint:CGPointMake(radianRadius, SELFHEIGHT)]; 277 | 278 | [path addCurveToPoint:CGPointMake(0, SELFHEIGHT-radianRadius) controlPoint1:CGPointMake(radianRadius, SELFHEIGHT) controlPoint2:CGPointMake(0, SELFHEIGHT)];// 添加弧线 279 | 280 | [path addLineToPoint:CGPointMake(0, arrowHeight+radianRadius)]; 281 | 282 | [path addCurveToPoint:CGPointMake(radianRadius, arrowHeight) controlPoint1:CGPointMake(0, arrowHeight+radianRadius) controlPoint2:CGPointMake(0, arrowHeight)];// 添加弧线 283 | 284 | [path addLineToPoint:CGPointMake(SELFWIDTH/2 - arrowHeight*atanh(M_PI/6), arrowHeight)]; 285 | [path addLineToPoint:CGPointMake(SELFWIDTH/2, 0)]; 286 | 287 | CAShapeLayer *pathLayer = [CAShapeLayer layer]; 288 | pathLayer.path = path.CGPath; 289 | pathLayer.lineWidth = 0; 290 | pathLayer.strokeColor = [UIColor whiteColor].CGColor; 291 | pathLayer.fillColor = [UIColor whiteColor].CGColor; 292 | 293 | self.layer.mask = pathLayer; 294 | } 295 | 296 | - (void)getBottomArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius { 297 | 298 | UIBezierPath *path = [UIBezierPath bezierPath]; 299 | 300 | [path moveToPoint:CGPointMake(SELFWIDTH/2, SELFHEIGHT)];// 上下画箭头,起点是(宽的一半,0/高);左右画箭头,起点是(0/宽,高的一半) 301 | 302 | [path addLineToPoint:CGPointMake(SELFWIDTH/2-arrowHeight*atanh(M_PI/6), SELFHEIGHT-arrowHeight)];// 和在左侧化箭头刚好颠倒过来 303 | 304 | [path addLineToPoint:CGPointMake(radianRadius,SELFHEIGHT-arrowHeight)]; 305 | 306 | // 第一个参数是目的点,第二个参数是控制画弧线的第一个控制点,第三个参数是控制画弧线的第二个控制点 307 | [path addCurveToPoint:CGPointMake(0, SELFHEIGHT-(arrowHeight+radianRadius)) controlPoint1:CGPointMake(radianRadius,SELFHEIGHT-arrowHeight) controlPoint2:CGPointMake(0, SELFHEIGHT-arrowHeight)];// 添加第一段弧线 308 | 309 | [path addLineToPoint:CGPointMake(0, radianRadius)]; 310 | 311 | [path addCurveToPoint:CGPointMake(radianRadius, 0) controlPoint1:CGPointMake(0, radianRadius) controlPoint2:CGPointMake(0, 0)];// 添加弧线 312 | 313 | [path addLineToPoint:CGPointMake(SELFWIDTH-radianRadius, 0)]; 314 | 315 | [path addCurveToPoint:CGPointMake(SELFWIDTH, radianRadius) controlPoint1:CGPointMake(SELFWIDTH-radianRadius, 0) controlPoint2:CGPointMake(SELFWIDTH, 0)];// 添加弧线 316 | 317 | [path addLineToPoint:CGPointMake(SELFWIDTH, SELFHEIGHT-(arrowHeight+radianRadius))]; 318 | 319 | [path addCurveToPoint:CGPointMake(SELFWIDTH-radianRadius, SELFHEIGHT-arrowHeight) controlPoint1:CGPointMake(SELFWIDTH, SELFHEIGHT-(arrowHeight+radianRadius)) controlPoint2:CGPointMake(SELFWIDTH, SELFHEIGHT-arrowHeight)];// 添加弧线 320 | 321 | [path addLineToPoint:CGPointMake(SELFWIDTH/2 + arrowHeight*atanh(M_PI/6), SELFHEIGHT-arrowHeight)]; 322 | [path addLineToPoint:CGPointMake(SELFWIDTH/2, SELFHEIGHT)]; 323 | 324 | CAShapeLayer *pathLayer = [CAShapeLayer layer]; 325 | pathLayer.path = path.CGPath; 326 | pathLayer.lineWidth = 0; 327 | pathLayer.strokeColor = [UIColor whiteColor].CGColor; 328 | pathLayer.fillColor = [UIColor whiteColor].CGColor; 329 | 330 | self.layer.mask = pathLayer; 331 | } 332 | 333 | - (void)getLeftArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius { 334 | 335 | UIBezierPath *path = [UIBezierPath bezierPath]; 336 | [path moveToPoint:CGPointMake(0, SELFHEIGHT/2)]; 337 | [path addLineToPoint:CGPointMake(arrowHeight, SELFHEIGHT/2-arrowHeight*atanh(M_PI/6))]; 338 | [path addLineToPoint:CGPointMake(arrowHeight, radianRadius)]; 339 | 340 | // 第一个参数是目的点,第二个参数是控制画弧线的第一个控制点,第三个参数是控制画弧线的第二个控制点 341 | [path addCurveToPoint:CGPointMake(arrowHeight+radianRadius, 0) controlPoint1:CGPointMake(arrowHeight, radianRadius) controlPoint2:CGPointMake(arrowHeight, 0)];// 添加第一段弧线 342 | 343 | [path addLineToPoint:CGPointMake(SELFWIDTH - radianRadius, 0)]; 344 | 345 | [path addCurveToPoint:CGPointMake(SELFWIDTH, radianRadius) controlPoint1:CGPointMake(SELFWIDTH - radianRadius, 0) controlPoint2:CGPointMake(SELFWIDTH, 0)];// 添加弧线 346 | 347 | [path addLineToPoint:CGPointMake(SELFWIDTH, SELFHEIGHT-radianRadius)]; 348 | 349 | [path addCurveToPoint:CGPointMake(SELFWIDTH - radianRadius, SELFHEIGHT) controlPoint1:CGPointMake(SELFWIDTH, SELFHEIGHT-radianRadius) controlPoint2:CGPointMake(SELFWIDTH, SELFHEIGHT)];// 添加弧线 350 | 351 | [path addLineToPoint:CGPointMake(arrowHeight+radianRadius, SELFHEIGHT)]; 352 | 353 | [path addCurveToPoint:CGPointMake(arrowHeight, SELFHEIGHT-radianRadius) controlPoint1:CGPointMake(arrowHeight+radianRadius, SELFHEIGHT) controlPoint2:CGPointMake(arrowHeight , SELFHEIGHT)];// 添加弧线 354 | [path addLineToPoint:CGPointMake(arrowHeight, SELFHEIGHT/2+arrowHeight*atanh(M_PI/6))]; 355 | [path addLineToPoint:CGPointMake(0, SELFHEIGHT/2)]; 356 | 357 | CAShapeLayer *pathLayer = [CAShapeLayer layer]; 358 | pathLayer.path = path.CGPath; 359 | pathLayer.lineWidth = 0; 360 | pathLayer.strokeColor = [UIColor whiteColor].CGColor; 361 | pathLayer.fillColor = [UIColor whiteColor].CGColor; 362 | 363 | self.layer.mask = pathLayer; 364 | 365 | } 366 | 367 | - (void)getRightArrowWitharrowHeight:(CGFloat)arrowHeight radianRadius:(CGFloat)radianRadius { 368 | 369 | UIBezierPath *path = [UIBezierPath bezierPath]; 370 | [path moveToPoint:CGPointMake(SELFWIDTH, SELFHEIGHT/2)]; 371 | 372 | [path addLineToPoint:CGPointMake(SELFWIDTH - arrowHeight, SELFHEIGHT/2+arrowHeight*atanh(M_PI/6))]; 373 | 374 | [path addLineToPoint:CGPointMake(SELFWIDTH - arrowHeight, SELFHEIGHT-radianRadius)]; 375 | 376 | // 第一个参数是目的点,第二个参数是控制画弧线的第一个控制点,第三个参数是控制画弧线的第二个控制点 377 | [path addCurveToPoint:CGPointMake(SELFWIDTH-(arrowHeight+radianRadius), SELFHEIGHT) controlPoint1:CGPointMake(SELFWIDTH - arrowHeight, SELFHEIGHT-radianRadius) controlPoint2:CGPointMake(SELFWIDTH - arrowHeight, SELFHEIGHT)];// 添加第一段弧线 378 | 379 | [path addLineToPoint:CGPointMake(radianRadius, SELFHEIGHT)]; 380 | 381 | [path addCurveToPoint:CGPointMake(0, SELFHEIGHT-radianRadius) controlPoint1:CGPointMake(radianRadius, SELFHEIGHT) controlPoint2:CGPointMake(0, SELFHEIGHT)];// 添加弧线 382 | 383 | [path addLineToPoint:CGPointMake(0, radianRadius)]; 384 | 385 | [path addCurveToPoint:CGPointMake(radianRadius, 0) controlPoint1:CGPointMake(0, radianRadius) controlPoint2:CGPointMake(0, 0)];// 添加弧线 386 | 387 | [path addLineToPoint:CGPointMake(SELFWIDTH-(arrowHeight+radianRadius), 0)]; 388 | 389 | [path addCurveToPoint:CGPointMake(SELFWIDTH-arrowHeight, radianRadius) controlPoint1:CGPointMake(SELFWIDTH-(arrowHeight+radianRadius), 0) controlPoint2:CGPointMake(SELFWIDTH-arrowHeight, 0)];// 添加弧线 390 | [path addLineToPoint:CGPointMake(SELFWIDTH-arrowHeight, SELFHEIGHT/2-arrowHeight*atanh(M_PI/6))]; 391 | 392 | [path addLineToPoint:CGPointMake(SELFWIDTH, SELFHEIGHT/2)]; 393 | 394 | CAShapeLayer *pathLayer = [CAShapeLayer layer]; 395 | pathLayer.path = path.CGPath; 396 | pathLayer.lineWidth = 0; 397 | pathLayer.strokeColor = [UIColor whiteColor].CGColor; 398 | pathLayer.fillColor = [UIColor whiteColor].CGColor; 399 | 400 | self.layer.mask = pathLayer; 401 | 402 | } 403 | 404 | @end 405 | -------------------------------------------------------------------------------- /Pop-upMenu/XYMenu/ArrowheadMenuSelectedState.m: -------------------------------------------------------------------------------- 1 | // 2 | // ArrowheadMenuSelectedState.m 3 | // Pop-upMenu 4 | // 5 | // Created by EastSun on 2018/3/19. 6 | // Copyright © 2018年 EastSun. All rights reserved. 7 | // 8 | 9 | #import "ArrowheadMenuSelectedState.h" 10 | 11 | @interface ArrowheadMenuSelectedState () 12 | 13 | /** 14 | 菜单背景图 15 | */ 16 | @property (nonatomic, strong, ) UIView *menuBackView; 17 | 18 | /** 19 | 菜单项 20 | */ 21 | @property (nonatomic, strong) UITableView *menuTableView; 22 | 23 | /** 24 | 常态下标题数组 25 | */ 26 | @property (nonatomic, strong) NSArray *normalTitleArray; 27 | 28 | /** 29 | 选中状态下标题数组 30 | */ 31 | @property (nonatomic, strong) NSArray *selectedTitleArray; 32 | 33 | /** 34 | 常态下图标数组 35 | */ 36 | @property (nonatomic, strong) NSArray *normalIconArray; 37 | 38 | /** 39 | 选中状态下图标数组 40 | */ 41 | @property (nonatomic, strong) NSArray *selectedIconArray; 42 | 43 | /** 44 | 开始位置 45 | */ 46 | @property (nonatomic, assign) CGRect startFrame; 47 | 48 | /** 49 | 菜单的位置 50 | */ 51 | @property (nonatomic, assign) CGRect menuRect; 52 | 53 | /** 54 | 菜单项目的位置 55 | */ 56 | @property (nonatomic, assign) CGRect menuItemRect; 57 | 58 | /** 59 | 箭头开始的点 60 | */ 61 | @property (nonatomic, assign) CGPoint arrowStartPoint; 62 | 63 | /** 64 | 菜单字体 65 | */ 66 | @property (nonatomic, strong) UIFont *font; 67 | 68 | /** 69 | 常态下菜单字体颜色 70 | */ 71 | @property (nonatomic, strong) NSArray *normalTitleColor; 72 | 73 | /** 74 | 选中状态下菜单字体颜色 75 | */ 76 | @property (nonatomic, strong) NSArray *selectedTitleColor; 77 | 78 | /** 79 | 菜单背景颜色 80 | */ 81 | @property (nonatomic, strong) UIColor *menuBackColor; 82 | 83 | /** 84 | 菜单分割线的颜色 85 | */ 86 | @property (nonatomic, strong) UIColor *separatorColor; 87 | 88 | /** 89 | 菜单和触发按钮的间隔 90 | */ 91 | @property (nonatomic, assign) CGFloat interval; 92 | 93 | /** 94 | 菜单项目单元格高度 95 | */ 96 | @property (nonatomic, assign) CGFloat cellHeight; 97 | 98 | /** 99 | 菜单宽度 100 | */ 101 | @property (nonatomic, assign) CGFloat menuWidth; 102 | 103 | /** 104 | 菜单高度 105 | */ 106 | @property (nonatomic, assign) CGFloat menuHeight; 107 | 108 | /** 109 | 菜单项目高度 110 | */ 111 | @property (nonatomic, assign) CGFloat menuItemHeight; 112 | 113 | /** 114 | 菜单项目宽度 115 | */ 116 | @property (nonatomic, assign) CGFloat menuItemWidth; 117 | 118 | /** 119 | 展示动画风格 120 | */ 121 | @property (nonatomic, assign) MenuShowAnimationStyle animationStyle; 122 | 123 | /** 124 | 位置 125 | */ 126 | @property (nonatomic, assign) MenuPlacements placements; 127 | 128 | /** 129 | 箭头风格 130 | */ 131 | @property (nonatomic, assign) MenuArrowStyle arrowStyle; 132 | 133 | /** 134 | 动画锚点 135 | */ 136 | @property (nonatomic, assign) CGPoint anchorPoint; 137 | 138 | /** 139 | 单选记录cell 140 | */ 141 | @property (nonatomic, strong) UITableViewCell *singleRecordCell; 142 | 143 | @end 144 | 145 | @implementation ArrowheadMenuSelectedState 146 | 147 | - (instancetype)initDefaultArrowheadStatusMenuWithNormalTitle:(NSArray *)normalTitleArray selectedTitle:(NSArray *)selectedTitleArray normalIcon:(NSArray *)normalIconArray selectedIcon:(NSArray *)selectedIconArray menuNormalTitleColor:(UIColor *)normalTitleColor menuSelectedTitleColor:(UIColor *)selectedTitleColor menuPlacements:(MenuPlacements)placements { 148 | 149 | return [self initCustomArrowheadStatusMenuWithNormalTitle:normalTitleArray selectedTitle:selectedTitleArray normalIcon:normalIconArray selectedIcon:selectedIconArray menuNormalTitleColor:normalTitleColor menuSelectedTitleColor:selectedTitleColor menuUnitSize:CGSizeMake([UIScreen mainScreen].bounds.size.width/3, 38) menuFont:[UIFont fontWithName:@"Helvetica" size:15.f] menuBackColor:[UIColor whiteColor] menuSegmentingLineColor:[UIColor colorWithRed:192/255.f green:196/255.f blue:201/255.f alpha:1] distanceFromTriggerSwitch:0 menuArrowStyle:MenuArrowStyleTriangle menuPlacements:placements showAnimationEffects:ShowAnimationZoom]; 150 | } 151 | 152 | - (instancetype)initCustomArrowheadStatusMenuWithNormalTitle:(NSArray *)normalTitleArray selectedTitle:(NSArray *)selectedTitleArray normalIcon:(NSArray *)normalIconArray selectedIcon:(NSArray *)selectedIconArray menuNormalTitleColor:(UIColor *)normalTitleColor menuSelectedTitleColor:(UIColor *)selectedTitleColor menuUnitSize:(CGSize)size menuFont:(UIFont *)font menuBackColor:(UIColor *)menuBackColor menuSegmentingLineColor:(UIColor *)separatorColor distanceFromTriggerSwitch:(CGFloat)interval menuArrowStyle:(MenuArrowStyle)arrowStyle menuPlacements:(MenuPlacements)placements showAnimationEffects:(MenuShowAnimationStyle)animation { 153 | 154 | NSMutableArray *nTitleColorArray = [NSMutableArray array]; 155 | NSMutableArray *sTitleColorArray = [NSMutableArray array]; 156 | for (NSInteger i = 0; i < normalTitleArray.count; i ++) { 157 | [nTitleColorArray addObject:normalTitleColor]; 158 | [sTitleColorArray addObject:selectedTitleColor]; 159 | } 160 | 161 | return [self initCustomArrowheadStatusMenuWithNormalTitle:normalTitleArray selectedTitle:selectedTitleArray normalIcon:normalIconArray selectedIcon:selectedIconArray menuNormalTitleColorArray:nTitleColorArray menuSelectedTitleColorArray:sTitleColorArray menuUnitSize:size menuFont:font menuBackColor:menuBackColor menuSegmentingLineColor:separatorColor distanceFromTriggerSwitch:interval menuArrowStyle:arrowStyle menuPlacements:placements showAnimationEffects:animation]; 162 | } 163 | 164 | - (instancetype)initCustomArrowheadStatusMenuWithNormalTitle:(NSArray *)normalTitleArray selectedTitle:(NSArray *)selectedTitleArray normalIcon:(NSArray *)normalIconArray selectedIcon:(NSArray *)selectedIconArray menuNormalTitleColorArray:(NSArray *)normalTitleColorArray menuSelectedTitleColorArray:(NSArray *)selectedTitleColorArray menuUnitSize:(CGSize)size menuFont:(UIFont *)font menuBackColor:(UIColor *)menuBackColor menuSegmentingLineColor:(UIColor *)separatorColor distanceFromTriggerSwitch:(CGFloat)interval menuArrowStyle:(MenuArrowStyle)arrowStyle menuPlacements:(MenuPlacements)placements showAnimationEffects:(MenuShowAnimationStyle)animation { 165 | 166 | self = [super init]; 167 | if (self) { 168 | 169 | self.font = font;// 菜单字体 170 | self.separatorColor = separatorColor; 171 | self.menuBackColor = menuBackColor;// 菜单背景颜色 172 | self.normalTitleColor = normalTitleColorArray;// 常态下字体颜色 173 | self.selectedTitleColor = selectedTitleColorArray;// 选中状态下 174 | self.cellHeight = size.height;// 菜单单元格高度 175 | self.menuItemWidth = size.width;// 菜单项目宽度 176 | self.menuItemHeight = size.height*normalTitleArray.count;// 菜单项目高度 177 | self.interval = interval;// 菜单和触发按钮的间隔 178 | self.normalTitleArray = normalTitleArray;// 常态下标题 179 | self.selectedTitleArray = selectedTitleArray;// 选中状态下标题 180 | self.normalIconArray = normalIconArray;// 常态下图标 181 | self.selectedIconArray = selectedIconArray;// 选中状态下图标 182 | self.arrowStyle = arrowStyle;// 箭头风格 183 | self.placements = placements;// 展示位置 184 | self.animationStyle = animation; // 展示动画 185 | } 186 | 187 | return self; 188 | } 189 | 190 | #pragma mark- 菜单位置和大小计算,并跟新菜单frame 191 | - (void)calculateMenuPositionAccordingTo:(NSObject *)tSwitch menuPlacements:(MenuPlacements)placementsStyle { 192 | // 1、将开关的frame转换绝对坐标 193 | [self calculateSwitchPosition:tSwitch]; 194 | 195 | // 2、计算菜单的位置 196 | switch (placementsStyle) { 197 | case 0:// 菜单在触发按钮上部显示 198 | { 199 | self.menuWidth = self.menuItemWidth;// 菜单宽度 200 | self.menuHeight = self.menuItemHeight + ARROWHEIGHT;// 菜单高度 201 | CGFloat centerX = self.startFrame.origin.x+self.startFrame.size.width/2;// 按钮水平方向中心点 202 | // 判断触发按钮位置 203 | if ( centerX - self.menuWidth/2 <0) {// 触发按钮太靠左了。 204 | self.menuRect = CGRectMake(ARROWHEIGHT, CGRectGetMinY(self.startFrame) - (self.menuHeight+self.interval), self.menuWidth, self.menuHeight); 205 | 206 | } else if ( centerX + self.menuWidth/2 > [UIScreen mainScreen].bounds.size.width) {// 触发按钮太靠右了 207 | self.menuRect = CGRectMake([UIScreen mainScreen].bounds.size.width - ARROWHEIGHT - self.menuWidth, CGRectGetMinY(self.startFrame) - (self.menuHeight+self.interval), self.menuWidth, self.menuHeight); 208 | 209 | } else { 210 | self.menuRect = CGRectMake(centerX - self.menuWidth/2, CGRectGetMinY(self.startFrame) - (self.menuHeight+self.interval), self.menuWidth, self.menuHeight); 211 | } 212 | 213 | self.arrowStartPoint = CGPointMake(centerX - self.menuRect.origin.x, self.menuHeight); 214 | 215 | self.menuItemRect = CGRectMake(0, 0, self.menuItemWidth, self.menuItemHeight); 216 | 217 | self.menuBackView.frame = self.menuRect; 218 | self.anchorPoint = CGPointMake(self.arrowStartPoint.x/self.menuWidth, 1.f);// 动画开始时的锚点 219 | 220 | switch (self.arrowStyle) { 221 | case 0:// 圆角箭头 222 | { 223 | [self.menuBackView getBottomRoundedArrowWitharrowHeight:ARROWHEIGHT radianRadius:MENUCORNERRADIUS startPoint:self.arrowStartPoint]; 224 | } 225 | break; 226 | case 1:// 尖角箭头 227 | { 228 | [self.menuBackView getBottomArrowWitharrowHeight:ARROWHEIGHT radianRadius:MENUCORNERRADIUS startPoint:self.arrowStartPoint]; 229 | } 230 | break; 231 | 232 | } 233 | 234 | } 235 | break; 236 | case 1:// 菜单在触发按钮左侧显示 237 | { 238 | self.menuWidth = self.menuItemWidth+ARROWHEIGHT;// 菜单宽度 239 | self.menuHeight = self.menuItemHeight;// 菜单高度 240 | CGFloat centerY = self.startFrame.origin.y+self.startFrame.size.height/2;// 按钮水平方向中心点 241 | // 判断触发按钮位置 242 | if ( centerY - self.menuHeight/2 <0) {// 触发按钮太靠上了。 243 | self.menuRect = CGRectMake(self.startFrame.origin.x-(self.menuWidth+self.interval), 0, self.menuWidth, self.menuHeight); 244 | 245 | } else if ( centerY + self.menuWidth/2 > [UIScreen mainScreen].bounds.size.width) {// 触发按钮太靠下了 246 | self.menuRect = CGRectMake(self.startFrame.origin.x-(self.menuWidth+self.interval), [UIScreen mainScreen].bounds.size.height - self.menuHeight, self.menuWidth, self.menuHeight); 247 | 248 | } else { 249 | self.menuRect = CGRectMake(self.startFrame.origin.x-(self.menuWidth+self.interval), centerY - self.menuHeight/2, self.menuWidth, self.menuHeight); 250 | } 251 | 252 | self.arrowStartPoint = CGPointMake(self.menuWidth, centerY-self.menuRect.origin.y); 253 | 254 | self.menuItemRect = CGRectMake(0, 0, self.menuItemWidth, self.menuItemHeight); 255 | 256 | self.menuBackView.frame = self.menuRect; 257 | self.anchorPoint = CGPointMake(1.f, self.arrowStartPoint.y/self.menuHeight);// 动画开始时的锚点 258 | 259 | [self.menuBackView getRightArrowWitharrowHeight:ARROWHEIGHT radianRadius:MENUCORNERRADIUS startPoint:self.arrowStartPoint]; 260 | 261 | } 262 | break; 263 | case 2:// 菜单在触发按钮底部显示 264 | { 265 | self.menuWidth = self.menuItemWidth;// 菜单宽度 266 | self.menuHeight = self.menuItemHeight + ARROWHEIGHT;// 菜单高度 267 | CGFloat centerX = self.startFrame.origin.x+self.startFrame.size.width/2;// 按钮水平方向中心点 268 | // 判断触发按钮位置 269 | if ( centerX - self.menuWidth/2 <0) {// 触发按钮太靠左了。 270 | self.menuRect = CGRectMake(ARROWHEIGHT, CGRectGetMaxY(self.startFrame)+self.interval, self.menuWidth, self.menuHeight); 271 | 272 | } else if ( centerX + self.menuWidth/2 > [UIScreen mainScreen].bounds.size.width) {// 触发按钮太靠右了 273 | self.menuRect = CGRectMake([UIScreen mainScreen].bounds.size.width - ARROWHEIGHT - self.menuWidth, CGRectGetMaxY(self.startFrame)+self.interval, self.menuWidth, self.menuHeight); 274 | 275 | } else { 276 | self.menuRect = CGRectMake(centerX - self.menuWidth/2, CGRectGetMaxY(self.startFrame)+self.interval, self.menuWidth, self.menuHeight); 277 | } 278 | 279 | self.arrowStartPoint = CGPointMake(centerX - self.menuRect.origin.x, 0); 280 | 281 | self.menuItemRect = CGRectMake(0, ARROWHEIGHT, self.menuItemWidth, self.menuItemHeight); 282 | 283 | self.menuBackView.frame = self.menuRect; 284 | self.anchorPoint = CGPointMake(self.arrowStartPoint.x/self.menuWidth, 0.f);// 动画开始时的锚点 285 | 286 | switch (self.arrowStyle) { 287 | case 0:// 圆角箭头 288 | { 289 | [self.menuBackView getTopRoundedArrowWitharrowHeight:ARROWHEIGHT radianRadius:MENUCORNERRADIUS startPoint:self.arrowStartPoint]; 290 | } 291 | break; 292 | case 1:// 尖角箭头 293 | { 294 | [self.menuBackView getTopArrowWitharrowHeight:ARROWHEIGHT radianRadius:MENUCORNERRADIUS startPoint:self.arrowStartPoint]; 295 | } 296 | break; 297 | 298 | } 299 | } 300 | break; 301 | case 3:// 菜单在触发按钮右侧显示 302 | { 303 | self.menuWidth = self.menuItemWidth+ARROWHEIGHT;// 菜单宽度 304 | self.menuHeight = self.menuItemHeight;// 菜单高度 305 | CGFloat centerY = self.startFrame.origin.y+self.startFrame.size.height/2;// 按钮水平方向中心点 306 | // 判断触发按钮位置 307 | if ( centerY - self.menuHeight/2 <0) {// 触发按钮太靠上了。 308 | self.menuRect = CGRectMake(CGRectGetMaxX(self.startFrame)+self.interval, 0, self.menuWidth, self.menuHeight); 309 | 310 | } else if ( centerY + self.menuWidth/2 > [UIScreen mainScreen].bounds.size.width) {// 触发按钮太靠下了 311 | self.menuRect = CGRectMake(CGRectGetMaxX(self.startFrame)+self.interval, [UIScreen mainScreen].bounds.size.height - self.menuHeight, self.menuWidth, self.menuHeight); 312 | 313 | } else { 314 | self.menuRect = CGRectMake(CGRectGetMaxX(self.startFrame)+self.interval, centerY - self.menuHeight/2, self.menuWidth, self.menuHeight); 315 | } 316 | 317 | self.arrowStartPoint = CGPointMake(0, centerY-self.menuRect.origin.y); 318 | self.menuItemRect = CGRectMake(ARROWHEIGHT, 0, self.menuItemWidth, self.menuItemHeight); 319 | 320 | self.menuBackView.frame = self.menuRect; 321 | self.anchorPoint = CGPointMake(0.f, self.arrowStartPoint.y/self.menuHeight);// 动画开始时的锚点 322 | 323 | [self.menuBackView getLeftArrowWitharrowHeight:ARROWHEIGHT radianRadius:MENUCORNERRADIUS startPoint:self.arrowStartPoint]; 324 | 325 | } 326 | break; 327 | } 328 | } 329 | 330 | #pragma mark- 绝对坐标转换 331 | - (void)calculateSwitchPosition:(NSObject *)tSwitch { 332 | UIView *view; 333 | if ([tSwitch isKindOfClass:[UIView class]]) {// 是view类,转换成绝对坐标 334 | view = (UIView *)tSwitch; 335 | } else if ([tSwitch isKindOfClass:[UIBarItem class]]) {// 导航栏或标签按钮 336 | view = [tSwitch valueForKey:@"view"]; 337 | } 338 | UIWindow *window = [UIApplication sharedApplication].keyWindow; 339 | self.startFrame = [view convertRect:view.bounds toView:window];// 转成相对于self.view的绝对坐标,因为传过来的控件不一定是self.view的直接子视图 340 | } 341 | 342 | #pragma mark- 弹出方法 343 | - (void)presentMenuView:(NSObject *)sender { 344 | // 1、根据触发控件sender的位置,计算菜单的位置 345 | [self calculateMenuPositionAccordingTo:sender menuPlacements:self.placements]; 346 | // 2、展示菜单 347 | [self presentMenuView]; 348 | } 349 | 350 | #pragma mark- 定制并展示菜单 351 | - (void)viewWillAppear:(BOOL)animated { 352 | [super viewWillAppear:animated]; 353 | 354 | // 1、设置菜单遮罩层颜色 355 | self.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0]; 356 | 357 | // 2、根据动画风格展示菜单 358 | switch (self.animationStyle) { 359 | case 0:// 无动画效果 360 | { 361 | [self.view addSubview:self.menuBackView]; 362 | } 363 | break; 364 | 365 | case 1:// 缩放效果 366 | { 367 | self.menuBackView.layer.anchorPoint = self.anchorPoint; 368 | self.menuBackView.frame = self.menuRect;// 设置锚点后,会影响frme的origin,所以需要重新赋值 369 | self.menuBackView.transform = CGAffineTransformMakeScale(0.01f, 0.01f); 370 | [UIView animateWithDuration:0.25f animations:^{ 371 | [self.view addSubview:self.menuBackView]; 372 | self.menuBackView.transform = CGAffineTransformIdentity; 373 | }]; 374 | } 375 | break; 376 | } 377 | 378 | } 379 | 380 | #pragma mark- 移除菜单 381 | - (void)removeMenuView { 382 | 383 | // 根据动画风格移除菜单 384 | switch (self.animationStyle) { 385 | case 0:// 无动画效果 386 | { 387 | [self.menuBackView removeFromSuperview]; 388 | [self dismissViewControllerAnimated:NO completion:nil]; 389 | } 390 | break; 391 | 392 | case 1:// 缩放效果 393 | { 394 | [UIView animateWithDuration:0.25f animations:^{ 395 | self.menuBackView.transform = CGAffineTransformMakeScale(0.6f, 0.6f); 396 | [self dismissViewControllerAnimated:NO completion:nil]; 397 | } completion:^(BOOL finished) { 398 | [self.menuBackView removeFromSuperview]; 399 | self.menuBackView.transform = CGAffineTransformIdentity;// 还原回来,否则会影响下次弹出 400 | }]; 401 | } 402 | break; 403 | } 404 | } 405 | 406 | #pragma mark- 菜单TableView代理方法 407 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 408 | 409 | UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 410 | NSLog(@"\n\n\n点击菜单后的状态:%d", cell.selected); 411 | if (!self.allowsMultipleSelection && self.singleRecordCell == cell) {// 如果是单选菜单,且点击了处于选中状态下的单元,就把该单元的选中状态设置为NO 412 | [self tableView:tableView didDeselectRowAtIndexPath:indexPath]; 413 | self.singleRecordCell = nil;//置空 414 | return; 415 | } else if (!self.allowsMultipleSelection && self.singleRecordCell != cell) {// 记录cell 416 | self.singleRecordCell = cell; 417 | } 418 | 419 | cell.textLabel.textColor = self.selectedTitleColor[indexPath.row]; 420 | if (self.selectedIconArray) { 421 | cell.imageView.image = [UIImage imageNamed:self.selectedIconArray[indexPath.row]]; 422 | } 423 | 424 | // 1、通知代理处理点击事件 425 | if ([self.delegate respondsToSelector:@selector(menu:didClickedMenuItemUnitWithTag:andItemUnitTitle:itemiUnitPostClickState:)]) { 426 | [self.delegate menu:self didClickedMenuItemUnitWithTag:indexPath.row andItemUnitTitle:self.normalTitleArray[indexPath.row] itemiUnitPostClickState:YES]; 427 | } 428 | // 2、移除菜单 429 | [self removeMenuView]; 430 | } 431 | 432 | // 当点击处于选中状态下的cell时,调用该方法 433 | - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath { 434 | 435 | UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 436 | 437 | 438 | NSLog(@"\n\n\n点击菜单后,cell变成非选中状态:%d", cell.selected); 439 | 440 | cell.textLabel.textColor = self.normalTitleColor[indexPath.row]; 441 | if (self.normalIconArray) { 442 | cell.imageView.image = [UIImage imageNamed:self.normalIconArray[indexPath.row]]; 443 | } 444 | // 1、通知代理处理点击事件 445 | if ([self.delegate respondsToSelector:@selector(menu:didClickedMenuItemUnitWithTag:andItemUnitTitle:itemiUnitPostClickState:)]) { 446 | [self.delegate menu:self didClickedMenuItemUnitWithTag:indexPath.row andItemUnitTitle:self.normalTitleColor[indexPath.row] itemiUnitPostClickState:NO]; 447 | } 448 | // 2、移除菜单 449 | [self removeMenuView]; 450 | } 451 | 452 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 453 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"%lu-+%lu", indexPath.row, indexPath.section]]; 454 | cell.textLabel.font = self.font; 455 | if (!cell) { 456 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[NSString stringWithFormat:@"%lu-+%lu", indexPath.row, indexPath.section]]; 457 | // 移除最后一个cell的分割线 458 | if (indexPath.row == [tableView numberOfRowsInSection:indexPath.section]-1) { 459 | 460 | cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, cell.bounds.size.width); 461 | } 462 | cell.backgroundColor = [UIColor clearColor]; 463 | // 设置菜单点击背景 464 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 465 | // 设置标题格式(默认为未选状态) 466 | cell.textLabel.textColor = self.normalTitleColor[indexPath.row]; 467 | // 设置菜单图标(默认为未选状态) 468 | if (self.normalIconArray) { 469 | cell.imageView.image = [UIImage imageNamed:self.normalIconArray[indexPath.row]]; 470 | cell.textLabel.textAlignment = NSTextAlignmentLeft; 471 | } else { 472 | cell.textLabel.textAlignment = NSTextAlignmentCenter; 473 | } 474 | // 设置菜单标题(默认为未选状态) 475 | cell.textLabel.text = self.normalTitleArray[indexPath.row]; 476 | 477 | } 478 | 479 | return cell; 480 | } 481 | 482 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 483 | return self.cellHeight; 484 | } 485 | 486 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 487 | return self.normalTitleArray.count; 488 | } 489 | 490 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 491 | return 1; 492 | } 493 | 494 | //MARK: 点击后去除自己的选中状态 495 | - (void)whenClickedUncheckOwnStatus:(NSInteger)tag { 496 | 497 | NSIndexPath *indexPath = [NSIndexPath indexPathForRow:tag inSection:0]; 498 | UITableViewCell *cell = [self.menuTableView cellForRowAtIndexPath:indexPath]; 499 | if (cell.selected) { 500 | cell.selected = NO; 501 | cell.textLabel.textColor = self.normalTitleColor[tag]; 502 | if (self.normalIconArray) { 503 | cell.imageView.image = [UIImage imageNamed:self.normalIconArray[tag]]; 504 | } 505 | } 506 | 507 | } 508 | 509 | #pragma mark- 控件懒加载 510 | - (UIView *)menuBackView { 511 | if (!_menuBackView) { 512 | _menuBackView = [[UIView alloc] init]; 513 | _menuBackView.backgroundColor = self.menuBackColor; 514 | // 添加菜单项 515 | [_menuBackView addSubview:self.menuTableView]; 516 | } 517 | 518 | return _menuBackView; 519 | } 520 | 521 | - (UITableView *)menuTableView { 522 | 523 | if (!_menuTableView) { 524 | _menuTableView = [[UITableView alloc] initWithFrame:self.menuItemRect style:UITableViewStylePlain]; 525 | _menuTableView.dataSource = self; 526 | _menuTableView.delegate = self; 527 | _menuTableView.bounces = NO; 528 | _menuTableView.showsVerticalScrollIndicator = NO; 529 | _menuTableView.tableFooterView = [[UIView alloc] init]; 530 | _menuTableView.backgroundColor = [UIColor clearColor]; 531 | 532 | // 分割线颜色 533 | _menuTableView.separatorColor = self.separatorColor; 534 | // 调整cell的分割线的位置 535 | _menuTableView.separatorInset = UIEdgeInsetsMake(0, 10, 0, 10); 536 | 537 | _menuTableView.layoutMargins = UIEdgeInsetsMake(0, 10, 0, 10); 538 | 539 | _menuTableView.allowsMultipleSelection = self.allowsMultipleSelection; 540 | 541 | } 542 | 543 | return _menuTableView; 544 | } 545 | 546 | - (void)viewDidLoad { 547 | [super viewDidLoad]; 548 | // Do any additional setup after loading the view. 549 | } 550 | 551 | - (void)didReceiveMemoryWarning { 552 | [super didReceiveMemoryWarning]; 553 | // Dispose of any resources that can be recreated. 554 | } 555 | 556 | @end 557 | -------------------------------------------------------------------------------- /Pop-upMenu.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8F87BCF0205F48A0000D8473 /* ArrowheadMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F87BCE7205F48A0000D8473 /* ArrowheadMenu.m */; }; 11 | 8F87BCF2205F48A0000D8473 /* BaseMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F87BCEB205F48A0000D8473 /* BaseMenuViewController.m */; }; 12 | 8F87BCF3205F48A0000D8473 /* CenterMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F87BCED205F48A0000D8473 /* CenterMenu.m */; }; 13 | 8F87BCF4205F48A0000D8473 /* UIView+DrawGraphics.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F87BCEF205F48A0000D8473 /* UIView+DrawGraphics.m */; }; 14 | 8F87BCF7205F498B000D8473 /* ArrowheadMenuSelectedState.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F87BCF6205F498B000D8473 /* ArrowheadMenuSelectedState.m */; }; 15 | 8F87BCFA205F4D5E000D8473 /* TestTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F87BCF9205F4D5E000D8473 /* TestTableViewController.m */; }; 16 | 8F87BCFD205F518F000D8473 /* TestArrowheadMenuSelectedStateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F87BCFC205F518F000D8473 /* TestArrowheadMenuSelectedStateViewController.m */; }; 17 | 8F8E11341FEB68AF00343F74 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F8E11331FEB68AF00343F74 /* AppDelegate.m */; }; 18 | 8F8E113A1FEB68AF00343F74 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8F8E11381FEB68AF00343F74 /* Main.storyboard */; }; 19 | 8F8E113C1FEB68AF00343F74 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8F8E113B1FEB68AF00343F74 /* Assets.xcassets */; }; 20 | 8F8E113F1FEB68AF00343F74 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8F8E113D1FEB68AF00343F74 /* LaunchScreen.storyboard */; }; 21 | 8F8E11421FEB68AF00343F74 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F8E11411FEB68AF00343F74 /* main.m */; }; 22 | 8F8E114C1FEB68AF00343F74 /* Pop_upMenuTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F8E114B1FEB68AF00343F74 /* Pop_upMenuTests.m */; }; 23 | 8F8E11571FEB68AF00343F74 /* Pop_upMenuUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F8E11561FEB68AF00343F74 /* Pop_upMenuUITests.m */; }; 24 | 8F8E11741FEB692400343F74 /* TestViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F8E11731FEB692400343F74 /* TestViewController.m */; }; 25 | 8F8E11771FEB693700343F74 /* TestTabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F8E11761FEB693700343F74 /* TestTabBarController.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 8F8E11481FEB68AF00343F74 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 8F8E11271FEB68AF00343F74 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 8F8E112E1FEB68AF00343F74; 34 | remoteInfo = "Pop-upMenu"; 35 | }; 36 | 8F8E11531FEB68AF00343F74 /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = 8F8E11271FEB68AF00343F74 /* Project object */; 39 | proxyType = 1; 40 | remoteGlobalIDString = 8F8E112E1FEB68AF00343F74; 41 | remoteInfo = "Pop-upMenu"; 42 | }; 43 | /* End PBXContainerItemProxy section */ 44 | 45 | /* Begin PBXFileReference section */ 46 | 8F87BCE6205F48A0000D8473 /* ArrowheadMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrowheadMenu.h; sourceTree = ""; }; 47 | 8F87BCE7205F48A0000D8473 /* ArrowheadMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ArrowheadMenu.m; sourceTree = ""; }; 48 | 8F87BCEA205F48A0000D8473 /* BaseMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseMenuViewController.h; sourceTree = ""; }; 49 | 8F87BCEB205F48A0000D8473 /* BaseMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseMenuViewController.m; sourceTree = ""; }; 50 | 8F87BCEC205F48A0000D8473 /* CenterMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CenterMenu.h; sourceTree = ""; }; 51 | 8F87BCED205F48A0000D8473 /* CenterMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CenterMenu.m; sourceTree = ""; }; 52 | 8F87BCEE205F48A0000D8473 /* UIView+DrawGraphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+DrawGraphics.h"; sourceTree = ""; }; 53 | 8F87BCEF205F48A0000D8473 /* UIView+DrawGraphics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+DrawGraphics.m"; sourceTree = ""; }; 54 | 8F87BCF5205F498B000D8473 /* ArrowheadMenuSelectedState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ArrowheadMenuSelectedState.h; sourceTree = ""; }; 55 | 8F87BCF6205F498B000D8473 /* ArrowheadMenuSelectedState.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ArrowheadMenuSelectedState.m; sourceTree = ""; }; 56 | 8F87BCF8205F4D5E000D8473 /* TestTableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestTableViewController.h; sourceTree = ""; }; 57 | 8F87BCF9205F4D5E000D8473 /* TestTableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestTableViewController.m; sourceTree = ""; }; 58 | 8F87BCFB205F518F000D8473 /* TestArrowheadMenuSelectedStateViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestArrowheadMenuSelectedStateViewController.h; sourceTree = ""; }; 59 | 8F87BCFC205F518F000D8473 /* TestArrowheadMenuSelectedStateViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestArrowheadMenuSelectedStateViewController.m; sourceTree = ""; }; 60 | 8F8E112F1FEB68AF00343F74 /* Pop-upMenu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Pop-upMenu.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | 8F8E11321FEB68AF00343F74 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 62 | 8F8E11331FEB68AF00343F74 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 63 | 8F8E11391FEB68AF00343F74 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 64 | 8F8E113B1FEB68AF00343F74 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 65 | 8F8E113E1FEB68AF00343F74 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 66 | 8F8E11401FEB68AF00343F74 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 67 | 8F8E11411FEB68AF00343F74 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 68 | 8F8E11471FEB68AF00343F74 /* Pop-upMenuTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Pop-upMenuTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 69 | 8F8E114B1FEB68AF00343F74 /* Pop_upMenuTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Pop_upMenuTests.m; sourceTree = ""; }; 70 | 8F8E114D1FEB68AF00343F74 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 71 | 8F8E11521FEB68AF00343F74 /* Pop-upMenuUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Pop-upMenuUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 72 | 8F8E11561FEB68AF00343F74 /* Pop_upMenuUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Pop_upMenuUITests.m; sourceTree = ""; }; 73 | 8F8E11581FEB68AF00343F74 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 74 | 8F8E11721FEB692400343F74 /* TestViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestViewController.h; sourceTree = ""; }; 75 | 8F8E11731FEB692400343F74 /* TestViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestViewController.m; sourceTree = ""; }; 76 | 8F8E11751FEB693700343F74 /* TestTabBarController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestTabBarController.h; sourceTree = ""; }; 77 | 8F8E11761FEB693700343F74 /* TestTabBarController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestTabBarController.m; sourceTree = ""; }; 78 | /* End PBXFileReference section */ 79 | 80 | /* Begin PBXFrameworksBuildPhase section */ 81 | 8F8E112C1FEB68AF00343F74 /* Frameworks */ = { 82 | isa = PBXFrameworksBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | ); 86 | runOnlyForDeploymentPostprocessing = 0; 87 | }; 88 | 8F8E11441FEB68AF00343F74 /* Frameworks */ = { 89 | isa = PBXFrameworksBuildPhase; 90 | buildActionMask = 2147483647; 91 | files = ( 92 | ); 93 | runOnlyForDeploymentPostprocessing = 0; 94 | }; 95 | 8F8E114F1FEB68AF00343F74 /* Frameworks */ = { 96 | isa = PBXFrameworksBuildPhase; 97 | buildActionMask = 2147483647; 98 | files = ( 99 | ); 100 | runOnlyForDeploymentPostprocessing = 0; 101 | }; 102 | /* End PBXFrameworksBuildPhase section */ 103 | 104 | /* Begin PBXGroup section */ 105 | 8F87BCE5205F48A0000D8473 /* XYMenu */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 8F87BCEE205F48A0000D8473 /* UIView+DrawGraphics.h */, 109 | 8F87BCEF205F48A0000D8473 /* UIView+DrawGraphics.m */, 110 | 8F87BCEA205F48A0000D8473 /* BaseMenuViewController.h */, 111 | 8F87BCEB205F48A0000D8473 /* BaseMenuViewController.m */, 112 | 8F87BCEC205F48A0000D8473 /* CenterMenu.h */, 113 | 8F87BCED205F48A0000D8473 /* CenterMenu.m */, 114 | 8F87BCE6205F48A0000D8473 /* ArrowheadMenu.h */, 115 | 8F87BCE7205F48A0000D8473 /* ArrowheadMenu.m */, 116 | 8F87BCF5205F498B000D8473 /* ArrowheadMenuSelectedState.h */, 117 | 8F87BCF6205F498B000D8473 /* ArrowheadMenuSelectedState.m */, 118 | ); 119 | path = XYMenu; 120 | sourceTree = ""; 121 | }; 122 | 8F8E11261FEB68AF00343F74 = { 123 | isa = PBXGroup; 124 | children = ( 125 | 8F8E11311FEB68AF00343F74 /* Pop-upMenu */, 126 | 8F8E114A1FEB68AF00343F74 /* Pop-upMenuTests */, 127 | 8F8E11551FEB68AF00343F74 /* Pop-upMenuUITests */, 128 | 8F8E11301FEB68AF00343F74 /* Products */, 129 | ); 130 | sourceTree = ""; 131 | }; 132 | 8F8E11301FEB68AF00343F74 /* Products */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 8F8E112F1FEB68AF00343F74 /* Pop-upMenu.app */, 136 | 8F8E11471FEB68AF00343F74 /* Pop-upMenuTests.xctest */, 137 | 8F8E11521FEB68AF00343F74 /* Pop-upMenuUITests.xctest */, 138 | ); 139 | name = Products; 140 | sourceTree = ""; 141 | }; 142 | 8F8E11311FEB68AF00343F74 /* Pop-upMenu */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 8F87BCE5205F48A0000D8473 /* XYMenu */, 146 | 8F8E11641FEB68FF00343F74 /* Test */, 147 | 8F8E11321FEB68AF00343F74 /* AppDelegate.h */, 148 | 8F8E11331FEB68AF00343F74 /* AppDelegate.m */, 149 | 8F8E11381FEB68AF00343F74 /* Main.storyboard */, 150 | 8F8E113B1FEB68AF00343F74 /* Assets.xcassets */, 151 | 8F8E113D1FEB68AF00343F74 /* LaunchScreen.storyboard */, 152 | 8F8E11401FEB68AF00343F74 /* Info.plist */, 153 | 8F8E11411FEB68AF00343F74 /* main.m */, 154 | ); 155 | path = "Pop-upMenu"; 156 | sourceTree = ""; 157 | }; 158 | 8F8E114A1FEB68AF00343F74 /* Pop-upMenuTests */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | 8F8E114B1FEB68AF00343F74 /* Pop_upMenuTests.m */, 162 | 8F8E114D1FEB68AF00343F74 /* Info.plist */, 163 | ); 164 | path = "Pop-upMenuTests"; 165 | sourceTree = ""; 166 | }; 167 | 8F8E11551FEB68AF00343F74 /* Pop-upMenuUITests */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | 8F8E11561FEB68AF00343F74 /* Pop_upMenuUITests.m */, 171 | 8F8E11581FEB68AF00343F74 /* Info.plist */, 172 | ); 173 | path = "Pop-upMenuUITests"; 174 | sourceTree = ""; 175 | }; 176 | 8F8E11641FEB68FF00343F74 /* Test */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | 8F87BCFB205F518F000D8473 /* TestArrowheadMenuSelectedStateViewController.h */, 180 | 8F87BCFC205F518F000D8473 /* TestArrowheadMenuSelectedStateViewController.m */, 181 | 8F87BCF8205F4D5E000D8473 /* TestTableViewController.h */, 182 | 8F87BCF9205F4D5E000D8473 /* TestTableViewController.m */, 183 | 8F8E11721FEB692400343F74 /* TestViewController.h */, 184 | 8F8E11731FEB692400343F74 /* TestViewController.m */, 185 | 8F8E11751FEB693700343F74 /* TestTabBarController.h */, 186 | 8F8E11761FEB693700343F74 /* TestTabBarController.m */, 187 | ); 188 | path = Test; 189 | sourceTree = ""; 190 | }; 191 | /* End PBXGroup section */ 192 | 193 | /* Begin PBXNativeTarget section */ 194 | 8F8E112E1FEB68AF00343F74 /* Pop-upMenu */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = 8F8E115B1FEB68AF00343F74 /* Build configuration list for PBXNativeTarget "Pop-upMenu" */; 197 | buildPhases = ( 198 | 8F8E112B1FEB68AF00343F74 /* Sources */, 199 | 8F8E112C1FEB68AF00343F74 /* Frameworks */, 200 | 8F8E112D1FEB68AF00343F74 /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | ); 206 | name = "Pop-upMenu"; 207 | productName = "Pop-upMenu"; 208 | productReference = 8F8E112F1FEB68AF00343F74 /* Pop-upMenu.app */; 209 | productType = "com.apple.product-type.application"; 210 | }; 211 | 8F8E11461FEB68AF00343F74 /* Pop-upMenuTests */ = { 212 | isa = PBXNativeTarget; 213 | buildConfigurationList = 8F8E115E1FEB68AF00343F74 /* Build configuration list for PBXNativeTarget "Pop-upMenuTests" */; 214 | buildPhases = ( 215 | 8F8E11431FEB68AF00343F74 /* Sources */, 216 | 8F8E11441FEB68AF00343F74 /* Frameworks */, 217 | 8F8E11451FEB68AF00343F74 /* Resources */, 218 | ); 219 | buildRules = ( 220 | ); 221 | dependencies = ( 222 | 8F8E11491FEB68AF00343F74 /* PBXTargetDependency */, 223 | ); 224 | name = "Pop-upMenuTests"; 225 | productName = "Pop-upMenuTests"; 226 | productReference = 8F8E11471FEB68AF00343F74 /* Pop-upMenuTests.xctest */; 227 | productType = "com.apple.product-type.bundle.unit-test"; 228 | }; 229 | 8F8E11511FEB68AF00343F74 /* Pop-upMenuUITests */ = { 230 | isa = PBXNativeTarget; 231 | buildConfigurationList = 8F8E11611FEB68AF00343F74 /* Build configuration list for PBXNativeTarget "Pop-upMenuUITests" */; 232 | buildPhases = ( 233 | 8F8E114E1FEB68AF00343F74 /* Sources */, 234 | 8F8E114F1FEB68AF00343F74 /* Frameworks */, 235 | 8F8E11501FEB68AF00343F74 /* Resources */, 236 | ); 237 | buildRules = ( 238 | ); 239 | dependencies = ( 240 | 8F8E11541FEB68AF00343F74 /* PBXTargetDependency */, 241 | ); 242 | name = "Pop-upMenuUITests"; 243 | productName = "Pop-upMenuUITests"; 244 | productReference = 8F8E11521FEB68AF00343F74 /* Pop-upMenuUITests.xctest */; 245 | productType = "com.apple.product-type.bundle.ui-testing"; 246 | }; 247 | /* End PBXNativeTarget section */ 248 | 249 | /* Begin PBXProject section */ 250 | 8F8E11271FEB68AF00343F74 /* Project object */ = { 251 | isa = PBXProject; 252 | attributes = { 253 | LastUpgradeCheck = 0920; 254 | ORGANIZATIONNAME = EastSun; 255 | TargetAttributes = { 256 | 8F8E112E1FEB68AF00343F74 = { 257 | CreatedOnToolsVersion = 9.2; 258 | ProvisioningStyle = Automatic; 259 | }; 260 | 8F8E11461FEB68AF00343F74 = { 261 | CreatedOnToolsVersion = 9.2; 262 | ProvisioningStyle = Automatic; 263 | TestTargetID = 8F8E112E1FEB68AF00343F74; 264 | }; 265 | 8F8E11511FEB68AF00343F74 = { 266 | CreatedOnToolsVersion = 9.2; 267 | ProvisioningStyle = Automatic; 268 | TestTargetID = 8F8E112E1FEB68AF00343F74; 269 | }; 270 | }; 271 | }; 272 | buildConfigurationList = 8F8E112A1FEB68AF00343F74 /* Build configuration list for PBXProject "Pop-upMenu" */; 273 | compatibilityVersion = "Xcode 8.0"; 274 | developmentRegion = en; 275 | hasScannedForEncodings = 0; 276 | knownRegions = ( 277 | en, 278 | Base, 279 | ); 280 | mainGroup = 8F8E11261FEB68AF00343F74; 281 | productRefGroup = 8F8E11301FEB68AF00343F74 /* Products */; 282 | projectDirPath = ""; 283 | projectRoot = ""; 284 | targets = ( 285 | 8F8E112E1FEB68AF00343F74 /* Pop-upMenu */, 286 | 8F8E11461FEB68AF00343F74 /* Pop-upMenuTests */, 287 | 8F8E11511FEB68AF00343F74 /* Pop-upMenuUITests */, 288 | ); 289 | }; 290 | /* End PBXProject section */ 291 | 292 | /* Begin PBXResourcesBuildPhase section */ 293 | 8F8E112D1FEB68AF00343F74 /* Resources */ = { 294 | isa = PBXResourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | 8F8E113F1FEB68AF00343F74 /* LaunchScreen.storyboard in Resources */, 298 | 8F8E113C1FEB68AF00343F74 /* Assets.xcassets in Resources */, 299 | 8F8E113A1FEB68AF00343F74 /* Main.storyboard in Resources */, 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | }; 303 | 8F8E11451FEB68AF00343F74 /* Resources */ = { 304 | isa = PBXResourcesBuildPhase; 305 | buildActionMask = 2147483647; 306 | files = ( 307 | ); 308 | runOnlyForDeploymentPostprocessing = 0; 309 | }; 310 | 8F8E11501FEB68AF00343F74 /* Resources */ = { 311 | isa = PBXResourcesBuildPhase; 312 | buildActionMask = 2147483647; 313 | files = ( 314 | ); 315 | runOnlyForDeploymentPostprocessing = 0; 316 | }; 317 | /* End PBXResourcesBuildPhase section */ 318 | 319 | /* Begin PBXSourcesBuildPhase section */ 320 | 8F8E112B1FEB68AF00343F74 /* Sources */ = { 321 | isa = PBXSourcesBuildPhase; 322 | buildActionMask = 2147483647; 323 | files = ( 324 | 8F87BCF0205F48A0000D8473 /* ArrowheadMenu.m in Sources */, 325 | 8F8E11421FEB68AF00343F74 /* main.m in Sources */, 326 | 8F8E11771FEB693700343F74 /* TestTabBarController.m in Sources */, 327 | 8F87BCF2205F48A0000D8473 /* BaseMenuViewController.m in Sources */, 328 | 8F87BCF3205F48A0000D8473 /* CenterMenu.m in Sources */, 329 | 8F8E11741FEB692400343F74 /* TestViewController.m in Sources */, 330 | 8F87BCFD205F518F000D8473 /* TestArrowheadMenuSelectedStateViewController.m in Sources */, 331 | 8F87BCF7205F498B000D8473 /* ArrowheadMenuSelectedState.m in Sources */, 332 | 8F87BCFA205F4D5E000D8473 /* TestTableViewController.m in Sources */, 333 | 8F8E11341FEB68AF00343F74 /* AppDelegate.m in Sources */, 334 | 8F87BCF4205F48A0000D8473 /* UIView+DrawGraphics.m in Sources */, 335 | ); 336 | runOnlyForDeploymentPostprocessing = 0; 337 | }; 338 | 8F8E11431FEB68AF00343F74 /* Sources */ = { 339 | isa = PBXSourcesBuildPhase; 340 | buildActionMask = 2147483647; 341 | files = ( 342 | 8F8E114C1FEB68AF00343F74 /* Pop_upMenuTests.m in Sources */, 343 | ); 344 | runOnlyForDeploymentPostprocessing = 0; 345 | }; 346 | 8F8E114E1FEB68AF00343F74 /* Sources */ = { 347 | isa = PBXSourcesBuildPhase; 348 | buildActionMask = 2147483647; 349 | files = ( 350 | 8F8E11571FEB68AF00343F74 /* Pop_upMenuUITests.m in Sources */, 351 | ); 352 | runOnlyForDeploymentPostprocessing = 0; 353 | }; 354 | /* End PBXSourcesBuildPhase section */ 355 | 356 | /* Begin PBXTargetDependency section */ 357 | 8F8E11491FEB68AF00343F74 /* PBXTargetDependency */ = { 358 | isa = PBXTargetDependency; 359 | target = 8F8E112E1FEB68AF00343F74 /* Pop-upMenu */; 360 | targetProxy = 8F8E11481FEB68AF00343F74 /* PBXContainerItemProxy */; 361 | }; 362 | 8F8E11541FEB68AF00343F74 /* PBXTargetDependency */ = { 363 | isa = PBXTargetDependency; 364 | target = 8F8E112E1FEB68AF00343F74 /* Pop-upMenu */; 365 | targetProxy = 8F8E11531FEB68AF00343F74 /* PBXContainerItemProxy */; 366 | }; 367 | /* End PBXTargetDependency section */ 368 | 369 | /* Begin PBXVariantGroup section */ 370 | 8F8E11381FEB68AF00343F74 /* Main.storyboard */ = { 371 | isa = PBXVariantGroup; 372 | children = ( 373 | 8F8E11391FEB68AF00343F74 /* Base */, 374 | ); 375 | name = Main.storyboard; 376 | sourceTree = ""; 377 | }; 378 | 8F8E113D1FEB68AF00343F74 /* LaunchScreen.storyboard */ = { 379 | isa = PBXVariantGroup; 380 | children = ( 381 | 8F8E113E1FEB68AF00343F74 /* Base */, 382 | ); 383 | name = LaunchScreen.storyboard; 384 | sourceTree = ""; 385 | }; 386 | /* End PBXVariantGroup section */ 387 | 388 | /* Begin XCBuildConfiguration section */ 389 | 8F8E11591FEB68AF00343F74 /* Debug */ = { 390 | isa = XCBuildConfiguration; 391 | buildSettings = { 392 | ALWAYS_SEARCH_USER_PATHS = NO; 393 | CLANG_ANALYZER_NONNULL = YES; 394 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 395 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 396 | CLANG_CXX_LIBRARY = "libc++"; 397 | CLANG_ENABLE_MODULES = YES; 398 | CLANG_ENABLE_OBJC_ARC = YES; 399 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 400 | CLANG_WARN_BOOL_CONVERSION = YES; 401 | CLANG_WARN_COMMA = YES; 402 | CLANG_WARN_CONSTANT_CONVERSION = YES; 403 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 404 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 405 | CLANG_WARN_EMPTY_BODY = YES; 406 | CLANG_WARN_ENUM_CONVERSION = YES; 407 | CLANG_WARN_INFINITE_RECURSION = YES; 408 | CLANG_WARN_INT_CONVERSION = YES; 409 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 416 | CLANG_WARN_UNREACHABLE_CODE = YES; 417 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 418 | CODE_SIGN_IDENTITY = "iPhone Developer"; 419 | COPY_PHASE_STRIP = NO; 420 | DEBUG_INFORMATION_FORMAT = dwarf; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | ENABLE_TESTABILITY = YES; 423 | GCC_C_LANGUAGE_STANDARD = gnu11; 424 | GCC_DYNAMIC_NO_PIC = NO; 425 | GCC_NO_COMMON_BLOCKS = YES; 426 | GCC_OPTIMIZATION_LEVEL = 0; 427 | GCC_PREPROCESSOR_DEFINITIONS = ( 428 | "DEBUG=1", 429 | "$(inherited)", 430 | ); 431 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 432 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 433 | GCC_WARN_UNDECLARED_SELECTOR = YES; 434 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 435 | GCC_WARN_UNUSED_FUNCTION = YES; 436 | GCC_WARN_UNUSED_VARIABLE = YES; 437 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 438 | MTL_ENABLE_DEBUG_INFO = YES; 439 | ONLY_ACTIVE_ARCH = YES; 440 | SDKROOT = iphoneos; 441 | }; 442 | name = Debug; 443 | }; 444 | 8F8E115A1FEB68AF00343F74 /* Release */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | ALWAYS_SEARCH_USER_PATHS = NO; 448 | CLANG_ANALYZER_NONNULL = YES; 449 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 450 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 451 | CLANG_CXX_LIBRARY = "libc++"; 452 | CLANG_ENABLE_MODULES = YES; 453 | CLANG_ENABLE_OBJC_ARC = YES; 454 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 455 | CLANG_WARN_BOOL_CONVERSION = YES; 456 | CLANG_WARN_COMMA = YES; 457 | CLANG_WARN_CONSTANT_CONVERSION = YES; 458 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 459 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 460 | CLANG_WARN_EMPTY_BODY = YES; 461 | CLANG_WARN_ENUM_CONVERSION = YES; 462 | CLANG_WARN_INFINITE_RECURSION = YES; 463 | CLANG_WARN_INT_CONVERSION = YES; 464 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 465 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 466 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 467 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 468 | CLANG_WARN_STRICT_PROTOTYPES = YES; 469 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 470 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 471 | CLANG_WARN_UNREACHABLE_CODE = YES; 472 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 473 | CODE_SIGN_IDENTITY = "iPhone Developer"; 474 | COPY_PHASE_STRIP = NO; 475 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 476 | ENABLE_NS_ASSERTIONS = NO; 477 | ENABLE_STRICT_OBJC_MSGSEND = YES; 478 | GCC_C_LANGUAGE_STANDARD = gnu11; 479 | GCC_NO_COMMON_BLOCKS = YES; 480 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 481 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 482 | GCC_WARN_UNDECLARED_SELECTOR = YES; 483 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 484 | GCC_WARN_UNUSED_FUNCTION = YES; 485 | GCC_WARN_UNUSED_VARIABLE = YES; 486 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 487 | MTL_ENABLE_DEBUG_INFO = NO; 488 | SDKROOT = iphoneos; 489 | VALIDATE_PRODUCT = YES; 490 | }; 491 | name = Release; 492 | }; 493 | 8F8E115C1FEB68AF00343F74 /* Debug */ = { 494 | isa = XCBuildConfiguration; 495 | buildSettings = { 496 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 497 | CODE_SIGN_STYLE = Automatic; 498 | DEVELOPMENT_TEAM = QGJ98D2L58; 499 | INFOPLIST_FILE = "Pop-upMenu/Info.plist"; 500 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 501 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 502 | PRODUCT_BUNDLE_IDENTIFIER = "net.eastsun.Pop-upMenu"; 503 | PRODUCT_NAME = "$(TARGET_NAME)"; 504 | TARGETED_DEVICE_FAMILY = "1,2"; 505 | }; 506 | name = Debug; 507 | }; 508 | 8F8E115D1FEB68AF00343F74 /* Release */ = { 509 | isa = XCBuildConfiguration; 510 | buildSettings = { 511 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 512 | CODE_SIGN_STYLE = Automatic; 513 | DEVELOPMENT_TEAM = QGJ98D2L58; 514 | INFOPLIST_FILE = "Pop-upMenu/Info.plist"; 515 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 516 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 517 | PRODUCT_BUNDLE_IDENTIFIER = "net.eastsun.Pop-upMenu"; 518 | PRODUCT_NAME = "$(TARGET_NAME)"; 519 | TARGETED_DEVICE_FAMILY = "1,2"; 520 | }; 521 | name = Release; 522 | }; 523 | 8F8E115F1FEB68AF00343F74 /* Debug */ = { 524 | isa = XCBuildConfiguration; 525 | buildSettings = { 526 | BUNDLE_LOADER = "$(TEST_HOST)"; 527 | CODE_SIGN_STYLE = Automatic; 528 | DEVELOPMENT_TEAM = QGJ98D2L58; 529 | INFOPLIST_FILE = "Pop-upMenuTests/Info.plist"; 530 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 531 | PRODUCT_BUNDLE_IDENTIFIER = "net.eastsun.Pop-upMenuTests"; 532 | PRODUCT_NAME = "$(TARGET_NAME)"; 533 | TARGETED_DEVICE_FAMILY = "1,2"; 534 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Pop-upMenu.app/Pop-upMenu"; 535 | }; 536 | name = Debug; 537 | }; 538 | 8F8E11601FEB68AF00343F74 /* Release */ = { 539 | isa = XCBuildConfiguration; 540 | buildSettings = { 541 | BUNDLE_LOADER = "$(TEST_HOST)"; 542 | CODE_SIGN_STYLE = Automatic; 543 | DEVELOPMENT_TEAM = QGJ98D2L58; 544 | INFOPLIST_FILE = "Pop-upMenuTests/Info.plist"; 545 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 546 | PRODUCT_BUNDLE_IDENTIFIER = "net.eastsun.Pop-upMenuTests"; 547 | PRODUCT_NAME = "$(TARGET_NAME)"; 548 | TARGETED_DEVICE_FAMILY = "1,2"; 549 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Pop-upMenu.app/Pop-upMenu"; 550 | }; 551 | name = Release; 552 | }; 553 | 8F8E11621FEB68AF00343F74 /* Debug */ = { 554 | isa = XCBuildConfiguration; 555 | buildSettings = { 556 | CODE_SIGN_STYLE = Automatic; 557 | DEVELOPMENT_TEAM = QGJ98D2L58; 558 | INFOPLIST_FILE = "Pop-upMenuUITests/Info.plist"; 559 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 560 | PRODUCT_BUNDLE_IDENTIFIER = "net.eastsun.Pop-upMenuUITests"; 561 | PRODUCT_NAME = "$(TARGET_NAME)"; 562 | TARGETED_DEVICE_FAMILY = "1,2"; 563 | TEST_TARGET_NAME = "Pop-upMenu"; 564 | }; 565 | name = Debug; 566 | }; 567 | 8F8E11631FEB68AF00343F74 /* Release */ = { 568 | isa = XCBuildConfiguration; 569 | buildSettings = { 570 | CODE_SIGN_STYLE = Automatic; 571 | DEVELOPMENT_TEAM = QGJ98D2L58; 572 | INFOPLIST_FILE = "Pop-upMenuUITests/Info.plist"; 573 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 574 | PRODUCT_BUNDLE_IDENTIFIER = "net.eastsun.Pop-upMenuUITests"; 575 | PRODUCT_NAME = "$(TARGET_NAME)"; 576 | TARGETED_DEVICE_FAMILY = "1,2"; 577 | TEST_TARGET_NAME = "Pop-upMenu"; 578 | }; 579 | name = Release; 580 | }; 581 | /* End XCBuildConfiguration section */ 582 | 583 | /* Begin XCConfigurationList section */ 584 | 8F8E112A1FEB68AF00343F74 /* Build configuration list for PBXProject "Pop-upMenu" */ = { 585 | isa = XCConfigurationList; 586 | buildConfigurations = ( 587 | 8F8E11591FEB68AF00343F74 /* Debug */, 588 | 8F8E115A1FEB68AF00343F74 /* Release */, 589 | ); 590 | defaultConfigurationIsVisible = 0; 591 | defaultConfigurationName = Release; 592 | }; 593 | 8F8E115B1FEB68AF00343F74 /* Build configuration list for PBXNativeTarget "Pop-upMenu" */ = { 594 | isa = XCConfigurationList; 595 | buildConfigurations = ( 596 | 8F8E115C1FEB68AF00343F74 /* Debug */, 597 | 8F8E115D1FEB68AF00343F74 /* Release */, 598 | ); 599 | defaultConfigurationIsVisible = 0; 600 | defaultConfigurationName = Release; 601 | }; 602 | 8F8E115E1FEB68AF00343F74 /* Build configuration list for PBXNativeTarget "Pop-upMenuTests" */ = { 603 | isa = XCConfigurationList; 604 | buildConfigurations = ( 605 | 8F8E115F1FEB68AF00343F74 /* Debug */, 606 | 8F8E11601FEB68AF00343F74 /* Release */, 607 | ); 608 | defaultConfigurationIsVisible = 0; 609 | defaultConfigurationName = Release; 610 | }; 611 | 8F8E11611FEB68AF00343F74 /* Build configuration list for PBXNativeTarget "Pop-upMenuUITests" */ = { 612 | isa = XCConfigurationList; 613 | buildConfigurations = ( 614 | 8F8E11621FEB68AF00343F74 /* Debug */, 615 | 8F8E11631FEB68AF00343F74 /* Release */, 616 | ); 617 | defaultConfigurationIsVisible = 0; 618 | defaultConfigurationName = Release; 619 | }; 620 | /* End XCConfigurationList section */ 621 | }; 622 | rootObject = 8F8E11271FEB68AF00343F74 /* Project object */; 623 | } 624 | --------------------------------------------------------------------------------