无法添加UIImageView?
我尝试将图像添加到我的视图中,在 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;
}
我的代码有什么问题,我的图片没有出现。请帮助我;(
I try to add Image into my view that in UIScrollView
here is my .h
@interface NormalDetail : UIViewController <UIScrollViewDelegate> {
IBOutlet UIImageView *lineImg;
}
@property (nonatomic, retain) UIImageView *lineImg;
@end
and here is my .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;
}
What's wrong with my code , My pic didn't appear. help me please ;(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将需要将 UIImageView 转换为 scollView。
You will needed to the UIImageView to the scorllView.