Skip to content

🇨🇳A view for set the the sort option.

Notifications You must be signed in to change notification settings

Story5/SortOptionView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Version Commit Data New In Version
1.0 2017.03.28 The first Version
1.1 2017.03.31 -imageShowStatusArrayForSortOptionView:
1.2 2017.07.13 -setCurrentSelectedItem:

Style

guide

Usage

1.Init and Show

SortOptionView  *sortOptionView = [[SortOptionView alloc] init];
sortOptionView.dataSource = self;
sortOptionView.delegate = self;
[aSuperView addSubview: sortOptionView];
[sortOptionView show];

2. Implement the method of 'SortOptionViewDataSource' protocol

(1)Return the every button's title

- (NSArray *)titleArrayForSortOptionView:(SortOptionView *)sortOptionView
{
    return @[@"SortTitle1",@"SortTitle2",@"SortTitle3"];
}

(2)Return the every button's image show status to determine show the image or not

- (NSArray *)imageShowStatusArrayForSortOptionView:(SortOptionView *)sortOptionView
{
    return @[@"0",@"1",@"1"];
}

3.Implement the method of 'SortOptionViewDelegate' protocol

- (void)sortOptionView:(SortOptionView *)sortOptionView didClickedItemAtIndex:(NSUInteger)index sortOption:(SortOptionType)sortOption
{
    switch (sortOption) {
        case SortOptionNormal:
            NSLog(@"SortOptionNormal");
            break;
        case SortOptionUp:
            NSLog(@"SortOptionUp");
            break;
        case SortOptionDown:
            NSLog(@"SortOptionDown");
            break;
        default:
            break;
    }

    NSLog(@"index : %lu",index);

    // do something by judge the index and sortOption
}

4.Set default selected item

[sortOptionView setCurrentSelectedItem:0];

Installation

1.Run 'git clone'

git clone https://github.com/GGSDU/SortOptionView

2.Import the SortOptionView folder to your project.

Code with Us together

If you'd like to code with us and make the project better,contact me and join us.

About

🇨🇳A view for set the the sort option.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published