0
peek/pop을 스토리 보드가 아닌 Objective-C 프로젝트에서 작동 시키려고하는데 흐림 배경 대신 흰색 배경이 계속 나타납니다. 나는 시뮬레이터와 iPhone에서 시험해 보았다.iOS 3D Touch Peek/Pop with Storyboards
- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location{
if ([self.presentedViewController isKindOfClass:[LoadTreatmentDetailViewController class]]) {
return nil;
}
NSIndexPath *indexPath = [self.loadTreatmentsTableView indexPathForRowAtPoint:location];
if(indexPath){
AllTreatmentsTableViewCell *tableCell = [self.loadTreatmentsTableView cellForRowAtIndexPath:indexPath];
if(tableCell.treatment){
LoadTreatmentDetailViewController *previewController = [[LoadTreatmentDetailViewController alloc] initWithTreatment:tableCell.treatment withContext:self.context];
if(previewController){
previewController.preferredContentSize = CGSizeMake(0.0, 0.0);
previewingContext.sourceRect = tableCell.frame;
return previewController;
}
}
}
return nil;
}
- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit{
[self presentViewController:viewControllerToCommit animated:YES completion:nil];
}
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[super traitCollectionDidChange:previousTraitCollection];
if([self isForceTouchAvailable]){
if(!self.previewingContext){
self.previewingContext = [self registerForPreviewingWithDelegate:self sourceView:self.view];
}
}else{
if(self.previewingContext){
[self unregisterForPreviewingWithContext:self.previewingContext];
self.previewingContext = nil;
}
}
}
- (BOOL)isForceTouchAvailable {
BOOL isForceTouchAvailable = NO;
if([self.traitCollection respondsToSelector:@selector(forceTouchCapability)]){
isForceTouchAvailable = self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable;
}
return isForceTouchAvailable;
}
가능합니까?
도움 주셔서 감사합니다.
나는 문제의 일부가 내가 앱에 가지고있는 UIAppearance 코드라고 생각한다. – Armando
약간의 흐림이 있지만, 여전히 흰색 배경을 얻고있다. 그리고 처음에는 그것을 눌렀을 때 tableviewcell이 보이지 않는다. – Armando