Latest 1.0.1
Homepage https://github.com/yanfj/YANScrollMenu
License MIT
Platforms ios 8.0, requires ARC
Dependencies SDWebImage, Masonry
Authors

YANScrollMenu|中文文档

License MIT
CocoaPods
CocoaPods

GIF

Requirements

  • ARC
  • iOS 8.0+

Cocoapods

YANScrollMenu is available via Cocoapods, add this line in your podfile :

pod 'YANScrollMenu', '~> 1.0.1'

Usage

1. Import the class :

#import "YANScrollMenu.h"

2. Simply initialize a YANScrollMenu the same way you set up a regular UIView:

self.menu = [[YANScrollMenu alloc] initWithFrame:CGRectMake(0, 0, 375,150) delegate:self];
# add to view
[self.view addSubview:self.menu];

# you can also set to be a tableHeaderView
self.tableView.tableHeaderView = self.menu;

3. YANScrollMenuDataSource must be adopted :

# the number of items in each section
- (NSUInteger)scrollMenu:(YANScrollMenu *)menu numberOfItemsInSection:(NSInteger)section;

# the number of section
- (NSUInteger)numberOfSectionsInScrollMenu:(YANScrollMenu *)menu;

# the dataSource of item
- (id<YANObjectProtocol>)scrollMenu:(YANScrollMenu *)scrollMenu objectAtIndexPath:(NSIndexPath *)indexPath;

4. There’re also some function in YANScrollMenuDelegate that can be used to customize:

# the size of item 
- (CGSize)itemSizeOfScrollMenu:(YANScrollMenu *)menu;

# the customize view to set to be the header  in each section
- (UIView *)scrollMenu:(YANScrollMenu *)menu headerInSection:(NSUInteger)section;

# the height of header    
- (CGFloat)heightOfHeaderInScrollMenu:(YANScrollMenu *)menu;

# the height of pageControl  
- (CGFloat)heightOfPageControlInScrollMenu:(YANScrollMenu *)menu;

# automatic update frame or not
- (BOOL)shouldAutomaticUpdateFrameInScrollMenu:(YANScrollMenu *)menu;

# the callback when the item did selected  
- (void)scrollMenu:(YANScrollMenu *)menu didSelectItemAtIndexPath:(NSIndexPath *)indexPath;

5. Custom appearance :

# the icon size of item
[[YANMenuItem appearance] setIconSize:30];

# the cornerRadius of icon
[[YANMenuItem appearance] setIconCornerRadius:15];

# the textFont of the  label
[[YANMenuItem appearance] setTextFont:[UIFont systemFontOfSize:12]];

# the textColor of the  label
[[YANMenuItem appearance] setTextColor:[UIColor darkTextColor]];

# the space between icon and label
[[YANMenuItem appearance] setSpace:5];

Dependency

YANScrollMenu depend on SDWebImage and Masonry.
Notes : When the version of SDWebImage large than 3.8.2 , gif will not be supported.

Release Notes

  • V 1.0.1 The repository has been changed
  • V 1.0.0 The framework has been refactored
  • V 0.9.1 Fix some bug and optimize the code
  • V 0.9.0 The first version

License

YANScrollMenu is released under the MIT license. See LICENSE file for details.

Contact

Any suggestion or question? Please create a Github issue .

Latest podspec

{
    "name": "YANScrollMenu",
    "version": "1.0.1",
    "summary": "u7b80u5355u6613u7528u7684u6ed1u52a8u83dcu5355",
    "description": "u7c7bu4f3cu7f8eu56e2u3001u5927u4f17u70b9u8bc4u7b49u9996u9875u7684u6ed1u52a8u83dcu5355uff0cu5177u6709u66f4u597du7684u62d3u5c55u6027",
    "homepage": "https://github.com/yanfj/YANScrollMenu",
    "license": "MIT",
    "authors": {
        "yanfj": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/yanfj/YANScrollMenu.git",
        "tag": "1.0.1"
    },
    "dependencies": {
        "SDWebImage": [
            "3.8.2"
        ],
        "Masonry": [
            "1.0.2"
        ]
    },
    "source_files": "YANScrollMenu/YANScrollMenu/YANScrollMenu/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This