EHHorizontalSelectionView

Horizontal table view style controller

Github星跟踪图

EHHorizontalSelectionView

This is extension for presenting horizontal lists of items (horizontal tableview)

Installation

CocoaPods

To install EHHorizontalSelectionView using CocoaPods, please integrate it in your existing Podfile, or create a new Podfile:

target 'MyApp' do
  pod 'EHHorizontalSelectionView'
end

Then run pod install.

Manual

Add files from EHHorizontalSelectionView to your project

Usage

#import <EHHorizontalSelectionView/EHHorizontalSelectionView.h>

You can use EHHorizontalSelectionView as outlet in your xib or storyboard

@property (nonatomic, weak) IBOutlet EHHorizontalSelectionView * hSelView;

Default style of table is with EHHorizontalViewCell cells. To change default behaviour you need register another cell class or cell nib. Custom cell must subclassed from EHHorizontalViewCell.

For example cell types with animated selection:

[_hSelView registerCellWithClass:[EHHorizontalLineViewCell class]];
[_hSelView1 registerCellWithClass:[EHRoundedHorizontalViewCell class]];

or your custom cell:

[_hSelView2 registerCellNib:[UINib nibWithNibName:@"MyCustomCellNib" bundle:nil] withClass:[EHHorizontalViewCell class]];

Setting delegate:

_hSelView1.delegate = self;

Delegate needs for getting data for selection view:

- (NSUInteger)numberOfItemsInHorizontalSelection:(EHHorizontalSelectionView*)hSelView
- (NSString *)titleForItemAtIndex:(NSUInteger)index forHorisontalSelection:(EHHorizontalSelectionView*)hSelView

and for receiving selection event:

- (void)horizontalSelection:(EHHorizontalSelectionView * _Nonnull)hSelView didSelectObjectAtIndex:(NSUInteger)index;

Tips

In case of "the behavior of the UICollectionViewFlowLayout is not defined because:" may help:

self.automaticallyAdjustsScrollViewInsets = NO;

Customization

IB customization

After 1.3.0 you can use IB to change selection view apperance. There was presented a set of properties allowing to change the appearance of the view.

EHHorizontalSelcetionView is now marked as IBDesignable and you can see customization on your xib or storyboard

Color

You can change default tint color for cell of selected type

[EHHorizontalLineViewCell updateTintColor:[UIColor colorWithHex:0x00c264]];

You can subclass cell of that type and override method + (UIColor * _Nonnull)tintColor;

+ (UIColor *)tintColor
{
  return [UIColor redColor];
}

Or you can change tint color for chosen selection view

    [_hSelView2 setTintColor:[UIColor colorWithHex:0xff46c7]];

Fonts

Change default appearance

[EHRoundedHorizontalViewCell updateFontMedium:[UIFont boldSystemFontOfSize:15]];
[EHRoundedHorizontalViewCell updateFont:[UIFont systemFontOfSize:15]];

Change for chosen selectionView

[_hSelView3 setFont:[UIFont systemFontOfSize:17]];

Additional width for cell (inset)

Change default appearance

[EHHorizontalLineViewCell updateCellGap:20];

Change for chosen selectionView

[_hSelView3 setCellGap:15.f];    

Line height (for EHHorizontalLineViewCell)

[EHHorizontalLineViewCell updateColorHeight:2];

Author

Danila Gusev

jos.shad@gmail.com

License

Usage is provided under the MIT License. See LICENSE for full details.

主要指标

概览
名称与所有者josshad/EHHorizontalSelectionView
主编程语言Objective-C
编程语言Objective-C (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2016-08-30 14:21:42
推送于2017-12-04 15:20:54
最后一次提交2017-12-04 18:19:18
发布数17
最新版本名称1.3.1 (发布于 )
第一版名称0.9.1 (发布于 )
用户参与
星数344
关注者数10
派生数60
提交数65
已启用问题?
问题数13
打开的问题数6
拉请求数2
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?