抵消UIRefreshControl [英] Offsetting UIRefreshControl

查看:98
本文介绍了抵消UIRefreshControl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为我的应用程序使用JASidePanel,并且我有一个带有UIRefreshControl的UITableViewcontroller作为它的ViewControllers之一。我的tableview的宽度仍然是320像素的宽度,因此UIRefreshControl在视图中间居中。我试图弄清楚是否有一种方法可以抵消UIRefreshControl(将x向左移动20个像素),这样当我的侧面板可见时它看起来居中。

I am currently using a JASidePanel for my application and I have a UITableViewcontroller with a UIRefreshControl as one of the ViewControllers for it. The width of my tableview still has a width of 320 pixels so the UIRefreshControl gets centered right in the middle of the view. I'm trying to figure out if there's a way to offset the UIRefreshControl (moving the x by 20 pixels to the left) so that it looks centered when I have my side panel visible.

谢谢!

Thanks!

推荐答案

您需要设置 UIRefreshControl 的框架。使用此代码

You need to set the frame of the UIRefreshControl. Use this code

UIRefreshControl *refContr=[[UIRefreshControl alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
[refContr setTintColor:[UIColor blueColor]];
[refContr setBackgroundColor:[UIColor greenColor]];

[stocktable addSubview:refContr];
[refContr setAutoresizingMask:(UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleLeftMargin)];

[[refContr.subviews objectAtIndex:0] setFrame:CGRectMake(30, 0, 20, 30)];


NSLog(@"subViews %@",refContr.subviews); 

输出:

Output:

这篇关于抵消UIRefreshControl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆