14

私はそのようなUIRefreshControlを使用します(UITableViewControllerなし):

UIRefreshControl *refreshControl = [UIRefreshControl new];
[refreshControl addTarget:self action:@selector(viewDidBeginRefreshing:) forControlEvents:UIControlEventValueChanged];
[self.table addSubview:refreshControl];

問題は、更新ホイールが UINavigationController の半透明バー (ios7) の下に配置されていることです。StackOverflow には、この問題に関するトピックがいくつかあります。そして、彼らは私に価値のある解決策をもたらしませんでした。

私が望むのは、たとえば、UIRefreshControl の y 位置を 80px 下にすることです。

注 : UITableViewController の外で UIRefreshControl を使用することはお勧めできません。したがって、それについて警告する必要はありません。

4

3 に答える 3

30

非常にシンプルで、それほどきれいではありませんが、魅力のように機能する解決策を見つけました。

設定されている別のサブビューに更新コントロールを配置するだけです。

UIView *refreshView = [[UIView alloc] initWithFrame:CGRectMake(0, 80, 0, 0)];
[self.table addSubview:refreshView];

UIRefreshControl *refreshControl = [UIRefreshControl new];
[refreshControl addTarget:self action:@selector(viewDidBeginRefreshing:) forControlEvents:UIControlEventValueChanged];
[refreshView addSubview:refreshControl];
于 2013-10-22T07:23:08.920 に答える
0

あなたのviewDidLoadにこれを追加してみてくださいUIViewController

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    self.edgesForExtendedLayout = UIRectEdgeNone;
于 2013-10-21T16:09:28.203 に答える