如何使用不同的图像和位置自定义UIRefreshControl? [英] How to customize UIRefreshControl with different image and position?
问题描述
我一直在环顾四周,但找不到任何关于此事的好消息。
I have been looking around but couldn't find anything good about this.
我想用不同的装载机等自定义默认的 UIRefeshControl
到目前为止,我只能更改 tintColor
& attributionTitle
属性和我找到的大多数代码基本上都是创建一个新的pulltorefresh
效果,但我想要的只是使用 UIRefreshControl
并稍微自定义。
I would like to customize the default UIRefeshControl
with different loader, etc. So far I can only change tintColor
& attributedTitle
properties and most code I found are just basically creating a new "pulltorefresh"
effect but what I want is to just use the UIRefreshControl
and customize it a bit.
这可能吗?
推荐答案
您无法在不访问私有API的情况下添加不同的加载程序,但您可以添加背景图像:
You can't add different loader without accessing private APIs, but you can add background image:
UIImageView *rcImageView =
[[UIImageView alloc] initWithImage:
[UIImage imageNamed: @"refreshControl.png"]];
[self.refreshControl insertSubview:rcImageView atIndex:0];
假设self是UITableViewController子类的实例。
assuming self is an instance of UITableViewController subclass.
您需要的图像尺寸为320x43px(@ 2x 640x86px),加载器动画将覆盖中间区域(约35px)。
Image size you need is 320x43px (@2x 640x86px), the middle area (approximately 35px) will be covered by the loader animation.
我在那里显示应用程序徽标......
I show application logo there...
这篇关于如何使用不同的图像和位置自定义UIRefreshControl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!