【问题标题】:SWTableViewCell left utility buttons, visible on first load in iPadSWTableViewCell 左侧实用按钮,在 iPad 中首次加载时可见
【发布时间】:2017-01-31 07:34:39
【问题描述】:

在 iPad 上,如果我运行我的应用程序,则会在加载视图时显示:
在我的PatientAppointmentTableViewCell 中,它是SWTableViewCell 的子类。 在这个类的.m 文件中我添加了这个方法:

- (void)layoutSubviews
{
    [super layoutSubviews];

    CGRect frame = self.contentView.frame;
    frame.origin.x = [self leftUtilityButtonsWidth];
    self.frame = frame;

    self.cellScrollView.contentSize = CGSizeMake(CGRectGetWidth(self.frame) + [self utilityButtonsPadding], CGRectGetHeight(self.frame));

    if (!self.cellScrollView.isTracking && !self.cellScrollView.isDecelerating)
    {
        self.cellScrollView.contentOffset = [self contentOffsetForCellState:_cellState];
        [self updateCellState];
    }
}

我在每一行都遇到错误

“PatientAppointmentTableViewCell”声明没有可见的@interface 选择器 leftUtilityButtonsWidth
在 PatientAppointmentTableViewCell 类型的对象上找不到属性 cellScrollView

那我做错了什么?

【问题讨论】:

  • 你确定它不是 iPad 的默认功能吗?
  • @Mr.UB 我不知道...是吗?好吧,它不应该只是像那样自动显示左键。

标签: ios uitableview ipad tableviewcell


【解决方案1】:

默认代码中的这个错误,也在 Github 存储库中提出。 见https://github.com/CEWendel/SWTableViewCell/issues/353的评论

这是修复,我用过,效果很好。

- (void)layoutSubviews
{    
    BOOL isPad = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad;
    if (isPad == YES) {
        layoutUpdating = YES;
        [super layoutSubviews];
        layoutUpdating = NO;
    } else {
        [super layoutSubviews];
    }

    // Offset the contentView origin so that it appears correctly w/rt the enclosing scroll view (to which we moved it).
    CGRect frame = self.contentView.frame;

【讨论】:

    猜你喜欢
    • 2011-06-15
    • 1970-01-01
    • 2023-01-18
    • 2017-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多