DQKFreezeWindowView,一个类似 Excel 冻结窗口效果的实现
DQKFreezeWindowView,一个类似 Excel 冻结窗口效果的实现,支持 dataSource delegate。
 
Note:
If this GIF(3.7 MB) looks not well, please refresh.
Usage
Install
Just addpod 'DQKFreezeWindowView'to your Podfile andpod install.
Use
UseDQKFreezeWindowViewjust likeUITableView,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.![]()
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
- 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.
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.
To Do
- Expand cell function
 - Fix some cell miss when you scroll fast
 - Fix Beta some bug
 - Add more style
 





