brandonscript
brandonscript

Reputation: 73034

How can I make a UIRefreshControl smaller?

UIRefreshControl uses a very large spinner:

I'd like to resize it (the frame of the spinner, not the pull-down length!) to look more like this:

I can't see anything in the reference docs about how do this, and though it inherits from UIView, setting the frame doesn't work (possibly because I'm using AutoLayout?)

let refreshControl = UIRefreshControl()
refreshControl.frame = CGRect.init(x: 0, y: 0, width: 32, height: 32)

Upvotes: 5

Views: 4717

Answers (3)

handzel
handzel

Reputation: 91

Update: Swift 5

refreshControl.transform = CGAffineTransform(scaleX: 0.75, y: 0.75)

Upvotes: 1

iamalizade
iamalizade

Reputation: 228

It's easy. Just select from the inspector:

I think you use a large one.

Also you can do this:

import QuartzCore
activityIndicator.transform = CGAffineTransformMakeScale(0.75, 0.75);

This will create an activity indicator 15px wide

Upvotes: 4

return true
return true

Reputation: 7916

Simply use refreshControl.transform = CGAffineTransformMakeScale(0.5, 0.5);

No need to import QuartzCore or doing whatever else.

Upvotes: 17

Related Questions