Open walteryaron opened 9 years ago
I have found a fix for the center problem with auto layout but need more time to test it out on non auto layout project. I will try to update as soon as possible
i've same problem with auto layout; if i put any constrain there's a problem on scrolling; all image shift to right
Same problem here, can't make center alignment. Any solution ? :-)
I found a solution. Configure your page control into viewDidLayoutSubviews method
If you can not able configure a component in viewDidLayoutSubviews (for example, it's subview in custom view class), as mentioned above, there are another solution:
-(void)myCustomInitMethod
// TAPageControl don't work correct with autolayout, observe frame
[self.pageControl addObserver:self forKeyPath:@"bounds" options:0 context:nil];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if (object == self.pageControl && [keyPath isEqualToString:@"bounds"]) {
// Set number of pages to trigger private update method
self.pageControl.numberOfPages = self.pageControl.numberOfPages;
}
}
-(void)dealloc{
[self.pageControl removeObserver:self forKeyPath:@"bounds"];
}
In case of auto layout..dot views are not aligned center in the View. they are start with right alignment.