私は現在-UIScrollView
、scrollView内にさらに情報を追加する関数を持っていますが、関数内でscrollViewのサイズを再計算し、それを大きくしようとしましたが、同じままです。
基本的に、その内部-viewDidLoad
で「デフォルト」サイズを設定します-UIScrollView
[self.xboxScrollView setContentSize:CGSizeMake(303, 2890)];
しばらくすると、デバイスは他のいくつかの値を-UIScrollView
- (void)addAnotherCheat:(NSString *)title :(NSString *)description index:(NSInteger)cheatID {
int titleLocation = 2744 + (cheatID * 101);
int titleDescription = 2766 + (cheatID * 101);
float lengthofscrollViews = 2866 + (cheatID * 101);
cheat1 = [[UILabel alloc] initWithFrame:CGRectMake(13, titleLocation, 287, 35)];
description1 = [[UILabel alloc] initWithFrame:CGRectMake(13, titleDescription, 287, 71)];
image1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, titleLocation, 306, 91)];
UIImage *image = [UIImage imageNamed: @"backggroundcolor.png"];
[self.xboxScrollView setContentSize:CGSizeMake(303, lengthofscrollViews)];
[self.xboxScrollView setScrollEnabled:YES];
NSLog(@"Scrollview Size : %f", self.xboxScrollView.contentSize.height);
[self.xboxScrollView addSubview:image1];
[self.xboxScrollView addSubview:cheat1];
[self.xboxScrollView addSubview:description1];
image1.image = image;
cheat1.backgroundColor=[UIColor clearColor];
cheat1.textColor = [UIColor whiteColor];
description1.backgroundColor=[UIColor clearColor];
description1.textColor = [UIColor whiteColor];
description1.numberOfLines = 3;
[cheat1 setFont:[UIFont fontWithName:@"STHeitiTC-Medium" size:19.0f]];
[description1 setFont:[UIFont fontWithName:@"STHeitiTC-Light" size:16.0f]];
cheat1.text = title;
description1.text = description;
}
本来あるべきサイズをログに記録すると、必要な正しい高さが出力されますが、高さは変わりません。
基本的に、ContentSize を既に設定している場合、scrollView を大きくする方法が必要です。