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!
Try editing the bounds
. For example, to move the control down +50px:
refreshControl.bounds = CGRectMake(refreshControl.bounds.origin.x, -50, refreshControl.bounds.size.width, refreshControl.bounds.size.height); [refreshControl beginRefreshing]; [refreshControl endRefreshing];
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With