开发者

UITableView in Cocos2D ( can't select a row)

开发者 https://www.devze.com 2023-02-16 04:51 出处:网络
In my cocos2D(cocos2d 0.99.5 version) project i integrated a uiview as the following code tView = [[UIView alloc] initWithFrame:CGRectMake(-90,85,480,320)];// ypo,xpos,width,height

In my cocos2D(cocos2d 0.99.5 version) project i integrated a uiview as the following code

tView = [[UIView alloc] initWithFrame:CGRectMake(-90,85,480,320)];  // ypo,xpos,width,height
    CGAffineTransform tr = tView.transform; // get current transform (portrait)
    tr = CGAffineTransformRotate(tr, (M_PI / 2.0)); // rotate 90 degrees to go landscape
    tView.transform = tr; // set current transform (landscape)
    [[[CCDirector sharedDirector] openGL开发者_运维问答View]  addSubview:tView]; 

and add a uitableview as a child to tView like this

tTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,50,480,320)

                                                      style:UITableViewStylePlain];

tTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;

tTableView.delegate = self;

tTableView.dataSource = self;

[tTableView reloadData];

[self.pView addSubview:tTableView];

the UITableView added correctly but i can't select a row in tableview.it scroll well . how to solve the this problem. Please give some suggestion

Thanks.


You might want to look into the Cocos2D version of UITableView, the CCTableView Suite, with the download page and examples here. That would work much better than mixing a UIKit view with Cocos2D.

0

精彩评论

暂无评论...
验证码 换一张
取 消