2014-09-04 2 views
3

UITableView 및 UIRefreshControl이있는 iOS 앱을 개발 중입니다.iOS 앱의 UIRefreshControl 표시기의 초기 위치 변경

UIRefreshControl 표시기의 초기 위치를 50px에서 기본값으로 변경하고 싶습니다. 다음 코드를 적어 둡니다.

그러나 초기 위치는 변경되지 않습니다. 그것은 원래 위치에 남아 있습니다.

이 문제를 해결하는 방법을 알려주시겠습니까?

CGFloat customRefreshControlHeight = 50.0f; 
CGFloat customRefreshControlWidth = 320.0f; 
CGRect customRefreshControlFrame = CGRectMake(0.0f, 
               customRefreshControlHeight, 
               customRefreshControlWidth, 
               customRefreshControlHeight); 
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] initWithFrame:customRefreshControlFrame]; 
refreshControl.tintColor = [UIColor blackColor]; 
[refreshControl addTarget:self action:@selector(onRefresh:) forControlEvents:UIControlEventValueChanged]; 
[self.tableView addSubview:refreshControl]; 

답변

0

그냥 간단한 (스위프트)

override func viewDidLayoutSubviews() { 
     super.viewDidLayoutSubviews() 
     refreshController.frame = CGRectMake(refreshController.bounds.origin.x, 
               50.0, 
               refreshController.bounds.size.width, 
               refreshController.bounds.size.height); 
     refreshController.superview?.sendSubviewToBack(refreshController) // for fix overlap tableview 
    }