Skip to content
This repository has been archived by the owner on Feb 14, 2019. It is now read-only.

DianQK/DQKFreezeWindowView

Repository files navigation

DQKFreezeWindowView

A freeze window effect view for iOS.
Just like Office Excel.

![Demo](https://raw.githubusercontent.com/DianQK/DQKFreezeWindowView/master/Screenshots/DemoVideo.gif)

Note:
If this GIF(3.7 MB) looks not well, please refresh.

Usage

Install

Just add pod 'DQKFreezeWindowView', '~> 0.9.1' to your Podfile and pod install.

Use

Use DQKFreezeWindowView just like UITableView,it's similar but also powerful.

#import "DQKFreezeWindowView.h" anywhere you want to use.
Initialize the freezeWindowView:

DQKFreezeWindowView *freezeWindowView = [[DQKFreezeWindowView alloc] initWithFrame:frame];
    [self.view addSubview:freezeWindowView];
    freezeWindowView.dataSource = self;
    freezeWindowView.delegate = self;

Note:
sectionCell at the top, rowCell at the left.

![](https://raw.githubusercontent.com/DianQK/DQKFreezeWindowView/master/Screenshots/ScrollViewPosition.png)

Incomplete implementation (dataSource):

- (NSInteger)numberOfSectionsInFreezeWindowView:(DQKFreezeWindowView *)freezeWindowView {
    return 100;
}

- (NSInteger)numberOfRowsInFreezeWindowView:(DQKFreezeWindowView *)freezeWindowView {
    return 100;
}

- (DQKMainViewCell *)freezeWindowView:(DQKFreezeWindowView *)freezeWindowView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *mainCell = @"mainCell";
    DQKMainViewCell *mainCell = [freezeWindowView dequeueReusableMainCellWithIdentifier:mainCell forIndexPath:indexPath];
    if (mainCell == nil) {
        mainCell = [[DQKMainViewCell alloc] initWithStyle:DQKMainViewCellStyleDefault reuseIdentifier:calendarCell];
        mainCell.title = @"mainCell";
    }
    return mainCell;
}

- (DQKSectionViewCell *)freezeWindowView:(DQKFreezeWindowView *)freezeWindowView cellAtSection:(NSInteger)section {
    static NSString *sectionCell = @"sectionCell";
    DQKSectionViewCell *sectionCell = [freezeWindowView dequeueReusableSectionCellWithIdentifier:dayCell forSection:section];
    if (sectionCell == nil) {
        sectionCell = [[DQKSectionViewCell alloc] initWithStyle:DQKSectionViewCellStyleDefault reuseIdentifier:dayCell];
        sectionCell.title = @"sectionCell";
    }
    return sectionCell;
}

- (DQKRowViewCell *)freezeWindowView:(DQKFreezeWindowView *)freezeWindowView cellAtRow:(NSInteger)row {
    static NSString *rowCell = @"rowCell";
    DQKRowViewCell *rowCell = [freezeWindowView dequeueReusableRowCellWithIdentifier:timeCell forRow:row];
    if (rowCell == nil) {
        rowCell = [[DQKRowViewCell alloc] initWithStyle:DQKRowViewCellStyleDefault reuseIdentifier:timeCell];
        rowCell.title = @"rowCell";
    }
    return rowCell;
}

Incomplete implementation (delegate):

- (void)freezeWindowView:(DQKFreezeWindowView *)freezeWindowView didSelectIndexPath:(NSIndexPath *)indexPath {
    NSString *message = [NSString stringWithFormat:@"Click at section: %ld row: %ld",(long)indexPath.section,(long)indexPath.row];
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"You did a click!" message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
    [alertView show];
}

Note: For more information, you can see DQKFreezeWindowViewExample and DQKFreezeWindowViewDemo. I prefer to DQKFreezeWindowViewDemo, it's interesting.

Other

When You Should Use DQKFreezeWindowView

You can use it for:

  • Calendar
  • Show Data
  • Syllabus
  • To Do Lists
  • ...

Why You should Try DQKFreezeWindowView

  1. Physical
    Look follow this picture:

The right picture is Calendar screenshot. When you use Calendar, you can't scroll view to horizontal direction after scrolling view to vertical direction instantly, which like a bug.

  1. Powerful
    Also can use for many datas to show

  2. Multiplex
    You can set DQKFreezeWindowView.bounceStyle.

More style you can see the project *.h file.

Beta Function

  • Tap Section to Top / Tap Row to Left
  • Detect A Cell Position
  • A Delegate -- When A Cell at A Key Position

Implementation

If you are interesting my project, you can see OtherSource . I put a part of Implementation.

An Article in Chinese.

Release Note

  • 0.9.1 Add AutoAligning
    You can set autoHorizontalAligning or autoVerticalAligning is YES.
    You can see the autoHorizontalAligning effect on DQKFreezeWindowViewDemo.

To Do

  • Expand cell function
  • Fix some cell miss when you scroll fast
  • Fix Beta some bug
  • Add more style

Talk

If you have some advice or problem, please put issues or chat with Weibo @靛青K. I need you help ^_^.

License

This code is distributed under the terms and conditions of the MIT license.

About

A freeze window effect view for iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published