【发布时间】:2014-10-02 00:30:34
【问题描述】:
我一直在开发一个应用程序,它进展顺利。然而,这个周末我更新到 Xcode 6,现在我的应用程序的行为与更新到 Xcode 6 之前不同。
我的应用中有一个 UITableView,我在 viewDidLoad 中旋转:
//Rotate playerCardsTable.
CGAffineTransform rotateTable = CGAffineTransformMakeRotation(-M_PI_2);
_playerCardsTable.transform = rotateTable;
_playerCardsTable.frame = CGRectMake(0, 0, _playerCardsTable.frame.size.width, _playerCardsTable.frame.size.height);
在更新之前的 Xcode(Xcode 5)中,我有这样的看法:
但是现在,在更新到 Xcode 6 之后,我有了这样的看法:
tableview 是旋转的,所以我有水平滚动,但看起来框架在旋转后没有正确更改。它高 320 像素,宽 80 像素,应该是相反的。我不知道为什么,但我似乎无法在代码中更改框架,换句话说,我在更改宽度和高度后看不到任何变化。
tableview 是通过界面构建器添加的,并包含自定义单元格:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ 静态 NSString *CellIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
NSString *cardName = [[[[[Game game] localPlayer] playerCards] objectAtIndex:indexPath.row] fileNameCard];
cell.cardImage.image = [UIImage imageNamed:cardName];
Card *card;
card = [[[[Game game] localPlayer] playerCards] objectAtIndex:indexPath.row];
if(card.playable == IsPlayable){
cell.backgroundColor = isPlayableColor;}
else if (card.playable == IsNotPlayable) {
cell.backgroundColor = isNotPlayableColor;}
else if (card.playable == IsReallyPlayable) {
cell.backgroundColor = isReallyPlayableColor;}
//Rotate image to align with rotated tableview.
CGAffineTransform rotateImage = CGAffineTransformMakeRotation(M_PI/2);
cell.cardImage.transform = rotateImage;
cell.playableImage.transform = rotateImage;
cell.cardImage.layer.borderWidth = 2;
cell.cardImage.layer.borderColor = [UIColor clearColor].CGColor;
cell.cardImage.layer.shouldRasterize = YES;
cell.cardImage.layer.rasterizationScale = [[UIScreen mainScreen] scale];
cell.cardImage.layer.shadowColor = [UIColor blackColor].CGColor;
cell.cardImage.layer.shadowOffset = CGSizeMake(0, 1);
cell.cardImage.layer.shadowOpacity = 0.7;
cell.cardImage.layer.shadowRadius = 2.0;
cell.cardImage.clipsToBounds = NO;
return cell;}
要清楚;更新后我没有更改任何代码,因此不同的行为是由更新引起的。
希望你们能帮忙。
谢谢!
【问题讨论】:
标签: ios xcode uitableview