A freeze window effect view for iOS.
Just like Office Excel.
Note:
If this GIF(3.7 MB) looks not well, please refresh.
Just add pod 'DQKFreezeWindowView', '~> 0.9.1'
to your Podfile and pod install
.
Use
DQKFreezeWindowView
just 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:
![](https://raw.githubusercontent.com/DianQK/DQKFreezeWindowView/master/Screenshots/ScrollViewPosition.png)
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.
You can use it for:
- Calendar
- Show Data
- Syllabus
- To Do Lists
- ...
- 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.
- Tap Section to Top / Tap Row to Left
- Detect A Cell Position
- A Delegate -- When A Cell at A Key Position
If you are interesting my project, you can see OtherSource . I put a part of Implementation.
An Article in Chinese.
- 0.9.1 Add AutoAligning
You can setautoHorizontalAligning
orautoVerticalAligning
isYES
.
You can see theautoHorizontalAligning
effect on DQKFreezeWindowViewDemo.
- Expand cell function
- Fix some cell miss when you scroll fast
- Fix Beta some bug
- Add more style
If you have some advice or problem, please put issues or chat with Weibo @靛青K. I need you help ^_^.
This code is distributed under the terms and conditions of the MIT license.