Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to customize UIRefreshControl with different image and position?

I have been looking around but couldn't find anything good about this.

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.

Is this possible?

like image 364
ivanasetiawan Avatar asked May 16 '13 12:05

ivanasetiawan


1 Answers

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];

assuming self is an instance of UITableViewController subclass.

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...

like image 124
esp Avatar answered Nov 03 '22 20:11

esp