0
我有滾動視圖的問題。我已經實現了兩個字體調整大小按鈕來增加或減少嵌入在滾動視圖中的文本視圖的文本字體大小。但是在縮小字體大小之後,我計算滾動視圖內容並對其進行修改以適應新的文本視圖高度。但每次修改文本字體時,都會向下滾動每一步。Scrollview調整內容大小
下面是代碼:
- (IBAction)decreaseText:(id)sender {
int MyTextSizeMin = 8;
int MyTextSizeMax = 20;
// disable buttons when they're out of the range.
BOOL smallerEnabled = textFontSize > MyTextSizeMin;
BOOL biggerEnabled = textFontSize < MyTextSizeMax;
[self.decreaseText setEnabled:smallerEnabled];
[self.increaseText setEnabled:biggerEnabled];
height =0;
CGFloat secondLabelsize = texto.font.pointSize;
[texto setFont:[UIFont systemFontOfSize:(secondLabelsize-1)]];
CGRect frame = texto.frame;
frame.size.height = texto.contentSize.height;
self.texto.frame = frame;
height +=texto.contentSize.height;
height += self.imagen.image.size.height;
height += self.fecha.frame.size.height;
height += self.titulo.frame.size.height;
height += 200;
self.scrollView.contentSize=CGSizeMake(300.0,height);
[self.scrollView setNeedsDisplay];
}
如何禁用這種不希望的滾動?
非常感謝!
非常感謝!!!!!!! – theomen