ios - Cocos2D v3 CCTableView 不滚动
<p><p>我正在尝试在我的游戏中使用 CCTableView。您应该能够滚动浏览名称列表。我可以单击一个单元格并记录单击了哪个单元格。但是,当我尝试滚动时,没有任何 Action 。</p>
<pre><code>@interface WSMPlayerCandidateSubMenu(){
CCNodeColor *_candidateSubMenuSprite;
}
@implementation WSMPlayerCandidateSubMenu
- (void)onEnter{
;
CGSize winSize = [ viewSize];
_candidateSubMenuSprite.color = ;
_candidateSubMenuSprite.userInteractionEnabled = NO;
self.candidateArray = [ returnCompany].candidates;
CCTableView *tblScores = ;
tblScores.contentSize = CGSizeMake(1.0,0.8);
tblScores.anchorPoint = ccp(0.5f,0.375f);
tblScores.positionType = CCPositionTypeNormalized;
tblScores.position = _candidateSubMenuSprite.position;
tblScores.userInteractionEnabled = YES;
tblScores.dataSource = self;
tblScores.verticalScrollEnabled = YES;
tblScores.block = ^(CCTableView *table){
NSLog(@"Cell %ld", (long)table.selectedRow);
};
;
}
-(CCTableViewCell*)tableView:(CCTableView *)tableView nodeForRowAtIndex:(NSUInteger)index{
CCTableViewCell* cell = ;
cell.contentSizeType = CCSizeTypeMake(CCSizeUnitNormalized, CCSizeUnitPoints);
cell.contentSize = CGSizeMake(1, 40);
// Color every other row differently
CCNodeColor* bg = ];
bg.userInteractionEnabled = NO;
bg.contentSizeType = CCSizeTypeNormalized;
bg.contentSize = CGSizeMake(1, 1);
;
WSMEmployee *candidate = (WSMEmployee*);
CCLabelTTF *lblCompanyName = ;
lblCompanyName.anchorPoint = ccp(1,0.5);
//lblTurnsSurvived.string = @"1000";
lblCompanyName.positionType = CCPositionTypeNormalized;
lblCompanyName.position = ccp(0.15,0.5);
lblCompanyName.color = ;
;
return cell;
}
-(NSUInteger)tableViewNumberOfRows:(CCTableView *)tableView{
return ;
}
-(float)tableView:(CCTableView *)tableView heightForRowAtIndex:(NSUInteger)index{
return 40.f;
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您需要在您的 <code>CCTableView</code> 实例上将 <code>multipleTouchEnabled</code> 设置为 <code>YES</code>。我有同样的问题,这对我有用。 </p></p>
<p style="font-size: 20px;">关于ios - Cocos2D v3 CCTableView 不滚动,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/30633875/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/30633875/
</a>
</p>
页:
[1]