IOS drop-down menu multiplexing

Source: Internet
Author: User
Tags uikit

Since the previous use of the drop-down menu, so now take some time to go back to carefully organize a bit, gradually improve the drop-down menu, and provide some more basic functions, so that in future if necessary, can be reused, and provide to the people who need reference. The drop-down menu is also divided into data sources and proxy methods, providing the following methods:

1 //2 //XWDropdownMenu.h3 //Xwreusablecodelib4 //5 //Created by Xiao on 15/10/30.6 //copyright©2015 year Xiao. All rights reserved.7 //Drop- down menu8 9 #import<UIKit/UIKit.h>Ten  One @classXwdropdownmenu; A #pragmaMark Data Source Method - @protocolXwdropdownmenudatasource <NSObject> - @required the /** - * How many lines are there in the main table? -  */ --(Nsinteger) numberofrowsinmaintable: (Xwdropdownmenu *) Dropdownmenu; + /** - * Title of each row of the main table + * @param row number A  */ at-(NSString *) Dropdownmenu: (Xwdropdownmenu *) Dropdownmenu titleforrowinmaintable: (nsinteger) row; - /** - * Sub-data array for each row of the main table - * @param row number -  */ --(Nsarray *) Dropdownmenu: (Xwdropdownmenu *) Dropdownmenu subdataforrowinmaintable: (nsinteger) row; in @optional - /** to * Number of categories per row of Main Table + * @param row number -  */ the-(NSString *) Dropdownmenu: (Xwdropdownmenu *) Dropdownmenu countforrowinmaintable: (nsinteger) row; * /** $ * sub-table each row sub-data category numberPanax Notoginseng * @param row number -  */ the-(Nsarray *) Dropdownmenu: (Xwdropdownmenu *) Dropdownmenu subdatacountforrowinsubtable: (nsinteger) row; + /** A * Icons for each row of the main table the * @param row number +  */ --(NSString *) Dropdownmenu: (Xwdropdownmenu *) Dropdownmenu iconforrowinmaintable: (nsinteger) row; $ /** $ * The selected icon for each row of the sub-table - * @param row number -  */ the-(NSString *) Dropdownmenu: (Xwdropdownmenu *) Dropdownmenu selectediconforrowinmaintable: (nsinteger) row; - @endWuyi  the #pragmaMark Proxy method - @protocolXwdropdownmenudelegate <NSObject> Wu  - @optional About- (void) Dropdownmenu: (Xwdropdownmenu *) Dropdownmenu didselectrowinmaintable: (nsinteger) row; $- (void) Dropdownmenu: (Xwdropdownmenu *) Dropdownmenu didselectrowinsubtable: (nsinteger) Subrow inmaintable: (Nsinteger) Mainrow; -  - @end -  A #pragmaMark Construction Method + @interfaceXwdropdownmenu:uiview the+(instancetype) Dropdownmenu; --(void) Refreshmenu; $  the@property (nonatomic, weak)ID<XWDropdownMenuDataSource>DataSource; the@property (nonatomic, weak)ID<XWDropdownMenuDelegate>Delegate; the  the /** Main Table is selected font color, default is black*/ -@property (Strong, nonatomic) Uicolor *Selectedrowtextcolor; in /** This property is set to Yes, and the main table is relatively small*/ the @property (nonatomic, assign) BOOL Ismaintablesmall; the @end

Since there is still some code, it is not possible to post all the code here, only to list the various methods and add comments, and attach a simple demo and

Demo Address: Https://github.com/xiaoyeying/XWDropdownMenuDemo.git

Finally, if there are shortcomings, please correct and criticize, study together ~ ~

IOS drop-down menu multiplexing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.