One
Because the simulator is smaller, some thin lines may not show up, not the bug ha.
Second, usage
Lfpopupmenuitem *item1 = [Lfpopupmenuitem createwithtitle:@"Small Video"Image:[uiimage imagenamed:@"Icon_menu_record_normal"]]; Lfpopupmenuitem*ITEM2 = [Lfpopupmenuitem createwithtitle:@"Take Pictures"Image:[uiimage imagenamed:@"Icon_menu_shoot_normal"]]; Lfpopupmenuitem*ITEM3 = [Lfpopupmenuitem createwithtitle:@"albums"Image:[uiimage imagenamed:@"Icon_menu_album_normal"]];self.items=@[item1, item2, Item3]; Lfpopupmenu*menu =[[Lfpopupmenu alloc] init]; [Menu ConfigWithItems:self.items Action:^(Nsinteger index) {NSLog (@"Click the first%zi", index); }]; [Menu Showarrowtoview:sender];
More ways to see. h files, with detailed comments
////LFPopupMenu.h//Lfpopupmenu////Created by Zhanglin on 2017/8/20.//Copyright 2017 Zhanglin. All rights reserved.//#import<UIKit/UIKit.h>typedef ns_enum (Nsinteger, popupmenudirection) {Popupmenudirection_auto,//arrows are automatically determined to be up or downPOPUPMENUDIRECTION_UP,//Arrow facing upPopupmenudirection_down//Arrow facing down};@interfaceLfpopupmenuitem:nsobject@property (nonatomic, strong) NSString*title: @property (Nonatomic, strong) UIImage*image;/** Generate option object, title and picture to pass at least one parameter*/+ (Lfpopupmenuitem *) Createwithtitle: (NSString *) title Image: (UIImage *) image;@end@interfaceLfpopupmenu:uiview/******* The following are all optional properties and have default values **********/@property (nonatomic, strong) UIView*maskview;//Translucent matte layer, default transparent, can be set by itself@property (nonatomic, strong) UIImage *IMGBG;//background map, set this will not need to draw the box with arrows. @property (nonatomic, strong) UIView *containerview;//container for customizing the inside view of a pop-up window@property (nonatomic, assign) CGFloat rowHeight;//row height, default@property (nonatomic, assign) CGFloat arrowh;//High Arrow, default 9@property (nonatomic, assign) CGFloat Arroww;//arrow shape width, default 9@property (nonatomic, assign) CGFloat minWidth;//minimum width of the popup, default 0@property (nonatomic, assign) CGFloat popupmargin;//the window is the minimum distance from the edge of the screen, default 5@property (nonatomic, assign) CGFloat leftedgemargin;//distance from window to left, default@property (nonatomic, assign) CGFloat rightedgemargin;//distance to the right margin window, default@property (nonatomic, assign) CGFloat textmargin;//distance from the text distance icon, default 8@property (nonatomic, assign) CGFloat linemargin;//Split Line left margin, default 0@property (nonatomic, assign) CGFloat Cornerradius;//pop-up window fillet, default 6@property (nonatomic, assign) CGFloat Arrowcornerradius;//rounded corners of arrows, default 0@property (nonatomic, strong) Uicolor *linecolor;//Split Line Color, border color, default system gray@property (nonatomic, strong) Uifont *textfont;//default@property (nonatomic, strong) Uicolor *textcolor;//default Black@property (nonatomic, strong) Uicolor *fillcolor;//Fill color with arrow box, default white@property (nonatomic, assign) BOOL Needborder;//whether to border@property (nonatomic, assign) Cgpoint Anchorpoint;//When setting the background graph, the triangle of the background graph is in the position ratio of the background map, such as the upper left corner (0,0), the lower right corner (at the top), the bottom Middle (0.5,1) and so on.@property (nonatomic, strong) UIView*menusuperview;//The parent view of the popup window, which is on the window by default@property (nonatomic, assign) popupmenudirection direction; @property (nonatomic, copy)void(^dismisscomplete) (void);//Vanishing Callback/** configuration options, note: After setting the above property, call @param items array of objects with text and caption @param action Click Callback, click on Index to determine the number of clicks*/- (void) Configwithitems: (Nsarray<lfpopupmenuitem *>*) Items action: (void(^) (Nsinteger index)) action;/** Fully customizable menu pop -up window*/- (void) Configwithcustomview: (UIView *) CustomView;/** Displays the menu window, which has a IMGBG call @param point the top left corner of the control, relative to window*/- (void) Showinpoint: (cgpoint) point;/** Show Menu window, call @param point arrow vertex position without IMGBG, relative window*/- (void) Showarrowinpoint: (cgpoint) point;/** Show Menu window, call without IMGBG (recommended) @param view Arrow Alignment View*/- (void) Showarrowtoview: (uiview*) view;- (void) dismiss;@end
This is just a sub-library of Lfkit, Lfkit address https://github.com/zhanglinfeng/LFKit
Just lfpopupmenu the pod ' Lfkit/lfpopupmenu '
Pod ' lfkit/component ' that requires all the custom controls in Lfkit
Pod ' Lfkit ' required for the general library
IOS with arrow menu options pop-up window Lfpopupmenu