1
This commit is contained in:
@@ -151,6 +151,14 @@
|
||||
[self loadPersonas];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
KBPersonaChatCell *cell = [self currentPersonaCell];
|
||||
if (cell) {
|
||||
[cell onBecameCurrentPersonaCell];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidLayoutSubviews {
|
||||
[super viewDidLayoutSubviews];
|
||||
if (self.bottomMaskLayer) {
|
||||
@@ -387,8 +395,27 @@
|
||||
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
|
||||
CGFloat pageHeight = scrollView.bounds.size.height;
|
||||
NSInteger currentPage = scrollView.contentOffset.y / pageHeight;
|
||||
NSInteger previousIndex = self.currentIndex;
|
||||
self.currentIndex = currentPage;
|
||||
|
||||
if (previousIndex != self.currentIndex) {
|
||||
NSIndexPath *prevPath = [NSIndexPath indexPathForItem:previousIndex inSection:0];
|
||||
KBPersonaChatCell *prevCell = (KBPersonaChatCell *)[self.collectionView cellForItemAtIndexPath:prevPath];
|
||||
if (prevCell) {
|
||||
[prevCell onResignedCurrentPersonaCell];
|
||||
}
|
||||
|
||||
KBPersonaChatCell *currentCell = [self currentPersonaCell];
|
||||
if (currentCell) {
|
||||
[currentCell onBecameCurrentPersonaCell];
|
||||
}
|
||||
} else {
|
||||
KBPersonaChatCell *currentCell = [self currentPersonaCell];
|
||||
if (currentCell) {
|
||||
[currentCell onBecameCurrentPersonaCell];
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPage < self.personas.count) {
|
||||
NSLog(@"当前在第 %ld 个人设:%@", (long)currentPage, self.personas[currentPage].name);
|
||||
// 保存当前选中的 persona 到 AppGroup,供键盘扩展使用
|
||||
|
||||
Reference in New Issue
Block a user