我尝试在UIScrollView
这是我的.h
@interface NormalDetail : UIViewController <UIScrollViewDelegate> {
IBOutlet UIImageView *lineImg;
}
@property (nonatomic, retain) UIImageView *lineImg;
@end
,这是我的.m
- (void)viewDidLoad
{
[super viewDidLoad];
//Set ScrollView
scrollView.contentSize = CGSizeMake(320.0f, 1800.0f);
//End Set ScrollView
[self setupTextView];
}
- (void) setupTextView
{
textDescription.scrollEnabled = NO;
NSString *foo = @"Hello Test";
textDescription.text = foo;
/*Here is something for dynamic textview*/
CGRect frame;
frame = textDescription.frame;
frame.size.height = [textDescription contentSize].height;
textDescription.frame = frame;
/**/
int linePosition = frame.size.height+20;
lineImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"line.png"]];
CGRect line2Frame = CGRectMake(-8, 600, 328, 10);
lineImg.frame = line2Frame;
}
我的代码出了什么问题,我的照片没有出现。请帮帮我;(
答案 0 :(得分:2)
您将需要UIImageView到scorllView。
- (void) setupTextView
{
textDescription.scrollEnabled = NO;
NSString *foo = @"Hello Test";
textDescription.text = foo;
/*Here is something for dynamic textview*/
CGRect frame;
frame = textDescription.frame;
frame.size.height = [textDescription contentSize].height;
textDescription.frame = frame;
/**/
int linePosition = frame.size.height+20;
lineImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"line.png"]];
CGRect line2Frame = CGRectMake(-8, 600, 328, 10);
lineImg.frame = line2Frame;
//Add the image view as a subview to yout scrollview.
[scrollView addSubView:lineImg];
}