2014-09-21 46 views
2

我工作的应用程序,因为一段时间,它进展顺利。然而,这个周末我更新到Xcode的6,现在我的应用程序表现为不同的更新Xcode的6Xcode 6和iOS 8更新后UITableView旋转行为奇怪

之前反对我在我的应用程序一个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)我有这样的观点:

enter image description here

但现在,更新到Xcode中6后,我有这样的观点:

enter image description here

tableview被旋转,ergo我有水平滚动,但它看起来像框架旋转后没有正确更改。它高320像素,宽80像素,应该是相反的。我不知道为什么,但似乎我无法在代码中更改框架,换句话说,在更改宽度和高度后我没有看到任何更改。

的tableview中经由接口构建器添加并保持定制单元:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

{ 静态的NSString * CellIdentifier = @ “小区”;

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;} 

要清楚;更新后我没有更改任何代码,因此不同的行为是由更新引起的。

希望你们能帮上忙。

谢谢!

回答

0

刚刚将iPad升级到ios8后,我遇到了非常类似的情况 - 水平表格显示不正确。

我没有一个完整的解决方案,但可以从研究和测试告诉你,在我的情况下,这是由于UITableView不协调/合作的变换操作和AutoLayout约束。很显然,这两个概念在ios8中一起工作的方式有些改变。

一个顶部约束在故事板设置成为后离开约束变换(或右,始终没弄明白正确)。

对我来说底线是,在尝试了一些约束组合后,包括在变换之前将它们移除,然后在变换之后重新添加约束,我最终从UITableView转换为UICollectionView

+0

我没有得到任何回应,所以我刚刚添加了一个新的'UITableView'并从那里开始工作。我认为侯对“AutoLayout”的想法是正确的,但我无法解决它。所以我开始使用'UITableView'并添加了新的约束条件等。现在它按预期工作。不管怎么说,还是要谢谢你! – Niels 2014-10-01 18:31:53