EHHorizontalSelectionView

Horizontal table view style controller

Github stars Tracking Chart

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.

Main metrics

Overview
Name With Ownerjosshad/EHHorizontalSelectionView
Primary LanguageObjective-C
Program languageObjective-C (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2016-08-30 14:21:42
Pushed At2017-12-04 15:20:54
Last Commit At2017-12-04 18:19:18
Release Count17
Last Release Name1.3.1 (Posted on )
First Release Name0.9.1 (Posted on )
用户参与
Stargazers Count344
Watchers Count10
Fork Count60
Commits Count65
Has Issues Enabled
Issues Count13
Issue Open Count6
Pull Requests Count2
Pull Requests Open Count0
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private