// storyboard--xib創(chuàng)建與代碼創(chuàng)建是有區(qū)別的
// 注意點:千萬不要通過索引去subviews數(shù)組中訪問scrollView子控件(取出來的不一定是你想要的控件)
[self.scrollView.subviews.firstObject removeFromSuperview];
// 注意點:通過代碼創(chuàng)建scrollView阴挣,一開始subviews這個數(shù)組為空nil
[NSLog(@"%@", scrollView.subviews)];
// 內(nèi)容的偏移量contentOffset
// 作用1:控制內(nèi)容滾動的位置
// 作用2:得知內(nèi)容滾動位置
self.scrollView.contentOffset = CGPointMake(200, 100);
// scrollView自己提供的動畫
[self.scrollView setContentOffset:CGPointMake(self.scrollView.contentOffset.x, 0) animation:YES];
// 內(nèi)邊距
self.scrollView.contentInset = UIEdgeInsetsMake(10, 20, 30, 40);
/*
1.任何OC對象都可以作為scrollView的代理
2.蘋果設(shè)計的代理屬性是weak,目的是防止循環(huán)引用棋返,造成內(nèi)存泄漏
*/
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者