【问题标题】:How to prevent see through UITableViewCell?如何防止看穿 UITableViewCell?
【发布时间】:2014-02-10 13:09:10
【问题描述】:

在开始使用 Xcode 5.0 后,我开始看穿 UITableViewCells:以前的 UIViewController 是可见的,即使它不在导航堆栈中。

  • 我正在使用Storyboards
  • 已使用方法- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated
  • TableHeaders 是不透明的,而只是 UITableViewCells

有什么想法吗?

【问题讨论】:

    标签: ios iphone objective-c uitableview ios7


    【解决方案1】:

    没有让你正确。但是试试这个。

    - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
    {
            [cell setBackgroundColor:[UIColor clearColor]];
    } 
    

    【讨论】:

    • 抱歉,在 iOS 7 中,我只在视图转换期间获得了透明的 UITableViewCells。
    【解决方案2】:

    我可以在@Pankaj 的回答的帮助下管理自己,但需要额外的代码。

    - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    
        if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
            // Load resources for iOS 6.1 or earlier
    
            [cell setBackgroundColor:[UIColor clearColor]];
    
        } else {
            // Load resources for iOS 7 or later
        }
    } 
    

    仅在 iOS 6 之前制作

    【讨论】:

      猜你喜欢
      • 2022-09-23
      • 1970-01-01
      • 1970-01-01
      • 2010-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多