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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?