【问题标题】:programmatically set uiimage's visibility以编程方式设置 uiimage 的可见性
【发布时间】:2010-11-20 18:25:48
【问题描述】:

我已经将界面生成器中的 UIImage 拖到视图上,并从下拉列表中选择了我的 PNG,效果很好,但是如果我想根据此表代码中的行数更改 uiimage 的可见性:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];
    return [sectionInfo numberOfObjects];
}

如果表中的行数大于 1(即存在行),我是否必须将 uiimage 声明为出口以及如何在上述代码中对可见性进行编码

【问题讨论】:

    标签: iphone objective-c uitableview uiimage


    【解决方案1】:

    如果您只想根据该部分中的行数来执行此操作,您应该能够执行以下操作:

    -(NSInteger)tableView: (UITableView *)tableView numberOfRowsInSection:(NSInteger) section {
          if(section == "whatever number you want to base the visibility off of")
                imageView.hidden = YES;
     }
    

    其中 imageView 是页面上的 UIImageView。

    【讨论】:

      【解决方案2】:

      尝试使用

      imageView.hidden = YES;
      

      【讨论】:

        猜你喜欢
        • 2021-10-30
        • 1970-01-01
        • 2011-12-16
        • 2023-01-17
        • 2012-11-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-03-22
        相关资源
        最近更新 更多