我怎樣才能重新在斯威夫特消氣從目標C斯威夫特
- (UIPageControl *)pageControl {
if (!_pageControl) {
_pageControl = [[UIPageControl alloc] init];
_pageControl.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
_pageControl.frame = (CGRect){0, 35, CGRectGetWidth(self.bounds), 0};
_pageControl.hidesForSinglePage = YES;
_pageControl.currentPage = self.currentPage;
_pageControl.currentPageIndicatorTintColor = [UIColor whiteColor];
_pageControl.pageIndicatorTintColor = [UIColor colorWithWhite:1.0 alpha:.5];
}
return _pageControl;
}
此獲取代碼這是我目前有
var pageControl: UIPageControl {
get{
if (self.pageControl == nil) {
var pageControl: UIPageControl= UIPageControl.alloc()
pageControl.autoresizingMask = .FlexibleWidth | .FlexibleTopMargin;
pageControl.frame = CGRectMake(0, 35, CGRectGetWidth(self.bounds), 0)
pageControl.hidesForSinglePage = true;
pageControl.currentPage = self.currentPage;
pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()
pageControl.pageIndicatorTintColor = UIColor(white: 1.0, alpha: 0.5)
return pageControl
}
return self.pageControl
}
}
但是,這是不一樣的,因爲它不是設置self.pageControl如果我嘗試添加此
self.pageControl = pageControl
我得到這個錯誤「無法分配到‘自我’的PageControl'」
and where is your _setter_? – holex