iphone - UIActivity 指示器用作 Uitableview 页脚时在设备中显示拉伸(stretch)?

标签 iphone ios ipad

我正在使用 UIActivity 指示器作为 UItableviewfooter, 我的代码显示在这里

spinner = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
 spinner.frame=CGRectMake(0, 0, 310, 44);
[spinner startAnimating];

self.myTableView.tableFooterView=spinner;

这在模拟器中运行良好,但当我在设备中运行它时,事件指示器似乎根据单元尺寸在两个轴上拉伸(stretch)。

最佳答案

spinner.frame=CGRectMake(0, 0, 310, 44);

可能是因为您将事件微调器的宽度设置为 310 磅。相反,将其设置为 44(使框架为正方形),并调整 x 原点参数使其居中。

目前我无法对此进行测试,但它可能采用以下形式:

CGFloat activityWidth = 44;
CGFloat activityHeight = 44;
CGFloat tableFooterViewWidth = self.myTableView.tableFooterView.frame.size.width;

spinner.frame=CGRectMake(tableFooterViewWidth - (activityWidth/2),
                         0,
                         activityWidth,
                         activityHeight);

关于iphone - UIActivity 指示器用作 Uitableview 页脚时在设备中显示拉伸(stretch)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13050662/

相关文章:

iphone - 语义问题 : Use of undeclared identifier when adding Framework class references

iphone - NSArchiver 与 NSKeyedArchiver 性能对比

c++ - 关于 OpenGLES 中的纹理切换

iphone - 旋转 UIView - willRotateToInterfaceOrientation 未被调用

ios - iOS应用因缺少应用内购买而被拒绝...要接受多长时间?

ios - 我的背景在手机和平​​板电脑上看起来不对,怎么办?

iphone - 触摸位置的值超出 View 范围

ios - iPad 上的 iPhone 应用程序 : drawViewHierarchyInRect causes glitch

ios - 如何在 ios 中生成包含图像数组的单页 pdf 文件?

iphone - 核心数据迁移 - 这是一个简单的迁移吗?应该如何完成?