我在与UISearchController关联的UINavigationItem的titleView中有一个UISearchBar.当我向后导航时,它似乎闪烁.有人见过这个吗?
@interface HNTileSearchViewController () <HNTileSearchResultsProtocol, SWRevealViewControllerDelegate, UISearchBarDelegate, HNSetSearchFiltersProtocol, HNKeywordResultsProtocol>
...
@property (nonatomic, strong) UISearchController *searchController;
@property (nonatomic, strong) UISearchBar * searchBarTop;
...
@end
@implementation HNTileSearchViewController
...
- (void) customPreSetup {
HNKeywordResultsTableViewController * searchResultsController = [self.storyboard instantiateViewControllerWithIdentifier:HNKeywordResultsTableViewControllerStoryboardIdentifier];
searchResultsController.delegate = self;
_searchController = [[UISearchController alloc] initWithSearchResultsController:searchResultsController];
_searchController.searchResultsUpdater = searchResultsController;
_searchController.hidesNavigationBarDuringPresentation = NO;
_searchController.dimsBackgroundDuringPresentation = NO;
_searchBarTop = _searchController.searchBar;
_searchBarTop.delegate = self;
_searchBarTop.placeholder = NSLocalizedString(@"Search heynay", nil);
_searchBarTop.showsCancelButton = NO;
_searchBarTop.showsScopeBar = NO;
self.navigationItem.titleView = _searchBarTop;
self.definesPresentationContext = YES;
}
- (void) …Run Code Online (Sandbox Code Playgroud) 之前曾问过这个问题,但最初的提问者不需要改变动态属性,所以他通过取消它来回答他自己的问题.
我在iOS7中使用Sprite Kit,我希望能够在运行时更改SKPhysicsBody的动态属性.最初我正在改变我的touchesBegan:方法.Apple Dev论坛中有人建议将更改移至didSimulatePhysics:方法,但这也无济于事.
此代码导致错误:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if (!heyWereSwappingDynamismHere)
{
heyWereSwappingDynamismHere = YES;
SKNode * rope = [self childNodeWithName:@"rope"];
SKNode * anchor = [rope childNodeWithName:@"anchor"];
[listOfObjectsToSwapDynamic addObject:anchor];
}
}
-(void) didSimulatePhysics
{
if (heyWereSwappingDynamismHere)
{
for (SKNode * node in listOfObjectsToSwapDynamic)
{
bool isItDynamic = node.physicsBody.isDynamic;
node.physicsBody.dynamic = !isItDynamic;
}
[listOfObjectsToSwapDynamic removeAllObjects];
heyWereSwappingDynamismHere = NO;
}
Run Code Online (Sandbox Code Playgroud)
}
调试器中出现的错误是:
断言失败:(的typeA == b2_dynamicBody || TYPEB == b2_dynamicBody),功能SolveTOI,文件/SourceCache/PhysicsKit/PhysicsKit-4.6/PhysicsKit/Box2D/Dynamics/b2World.cpp,670路.
我在其他地方环顾四周,但这似乎是Sprite Kit实现(并覆盖)Box2D的一个问题.
也许?