Iphone Can';不添加UIImageView?
我尝试在Iphone Can';不添加UIImageView?,iphone,objective-c,ios4,uiimageview,Iphone,Objective C,Ios4,Uiimageview,我尝试在UIScrollView 这是我的.h @interface NormalDetail : UIViewController <UIScrollViewDelegate> { IBOutlet UIImageView *lineImg; } @property (nonatomic, retain) UIImageView *lineImg; @end 我的代码有什么问题,我的照片没有出现。请帮帮我;(您需要将UIImageView转换为SCORLView
UIScrollView
这是我的.h
@interface NormalDetail : UIViewController <UIScrollViewDelegate> {
IBOutlet UIImageView *lineImg;
}
@property (nonatomic, retain) UIImageView *lineImg;
@end
我的代码有什么问题,我的照片没有出现。请帮帮我;(您需要将UIImageView转换为SCORLView
- (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];
}
并且仅当您在xib中添加了对象时才使用
IBOutlet
。当您使用IBOutlet
时,将其用作`IBOutlet Class*ObjectName;`进行声明。并将属性创建为@属性(非原子,保留)IBOutlet Class*ObjectName;
并且不要忘记用xib绑定对象。不,在本例中不是。代码不使用.syntax访问属性。
- (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];
}