我有一个UITableView,UISegmentedControl标题视图中有一个.它应该像在App Store应用程序中一样工作:当用户滚动时,标题中的标题会滚动屏幕,但是在标题segmentedControl下方navigationBar.

当用户选择一个段时,标题下面的部分应该重新加载一个好的UITableViewRowAnimation.但是,正如我所说tableView:reloadSections:withRowAnimation:,标题视图也是动画的,我想阻止它,因为它看起来很糟糕.
这是我的代码:
- (void)selectedSegmentIndexChanged:(UISegmentedControl *)sender
{
int index = sender.selectedSegmentIndex;
if (index < self.oldIndex) {
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationLeft];
} else if (index > self.oldIndex) {
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationRight];
}
self.oldIndex = index;
}
Run Code Online (Sandbox Code Playgroud)
任何人都知道如何重新加载标题下方的部分而不重新加载标题本身?
似乎Swift无法识别Objective-C-Header中的typedef,因为我得到以下错误:
无法从"MMDrawerControllerDrawerVisualStateBlock!"类型中找到用户定义的转换 输入'(MMDrawerController!,MMDrawerSide,CGFloat) - > Void'
我使用的是用Objective-C编写的MMDrawerController,我自己的代码虽然在Swift中.
typedef如下所示:
typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController * drawerController, MMDrawerSide drawerSide, CGFloat percentVisible);
Run Code Online (Sandbox Code Playgroud)
为清晰起见,这里有更多代码段:
AppDelegate.swift
func initDrawerController() {
drawerController = MMDrawerController(centerViewController: centerController, leftDrawerViewController: leftDrawerController, rightDrawerViewController: rightDrawerController)
drawerController?.setDrawerVisualStateBlock(MMDrawerVisualState.parallaxVisualStateBlockWithParallaxFactor(2.0))
}
Run Code Online (Sandbox Code Playgroud)
MMDrawerController.h
typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController * drawerController, MMDrawerSide drawerSide, CGFloat percentVisible);
@interface MMDrawerController : UIViewController
-(void)setDrawerVisualStateBlock:(void(^)(MMDrawerController * drawerController, MMDrawerSide drawerSide, CGFloat percentVisible))drawerVisualStateBlock;
@end
Run Code Online (Sandbox Code Playgroud)
MMDrawerVisualState.h
@interface MMDrawerVisualState : NSObject
+(MMDrawerControllerDrawerVisualStateBlock)parallaxVisualStateBlockWithParallaxFactor:(CGFloat)parallaxFactor;
@end
Run Code Online (Sandbox Code Playgroud)
模块桥接-Header.h
#import "MMDrawerController.h"
#import "MMDrawerVisualState.h"
Run Code Online (Sandbox Code Playgroud)
构建这个时,我的AppDelegate中出现了一个表达式错误setDrawerVisualStateBlock,尽管在下面有一个typedef MMDrawerController.h:
这是一个错误(因为在Objective-C上,它工作正常)?或者有谁知道/有想法如何处理它?非常感谢帮助,谢谢!
无法弄清楚发生了什么.
我正在构建一个使用带分页的滚动视图的iPhone应用程序.滚动视图包含多个视图,其视图控制器通过调用以下方式从故事板中加载:
[self.storyboard instantiateViewControllerWithIdentifier:@"identifier"];
Run Code Online (Sandbox Code Playgroud)
我将视图控制器添加到一个可变数组中,并将它们的视图作为子视图添加到滚动视图中.在屏幕上显示后,视图控制器将被取消分配,因此目标操作不再起作用.
当我启用Zombie Objects时,调试器在向控制器发送操作时写了这个:
*** - [StreamingViewController performSelector:withObject:withObject:]:消息发送到解除分配的实例0x914f0e0
我真的试图解决这个问题,但没有成功,所以非常感谢每一个帮助.
更多代码:
StreamingViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"Streaming View Controller"];
[self.pageControllers addObject:controller]; // adding view controller to mutable array
controller.view.frame = self.scrollView.frame;
[self.scrollView addSubview:controller.view];
Run Code Online (Sandbox Code Playgroud)