我要給它包含按鈕和TextView的。什麼我想要的是垂直滾動視圖...反芻能跟大家幫我出下面是代碼...如何添加一個垂直滾動視圖
- (id)initWithItem:(NSString *)theItem Title:(NSString *)title Description:(NSString *)detaildesc{
if (self = [super initWithNibName:@"Secondetailview" bundle:nil]) {
self.theItem1=theItem;
self.theTitle=title;
UILabel *tit = [[[UILabel alloc] initWithFrame:CGRectMake(10, 10, 200, 25)] autorelease];
[tit setBackgroundColor:[UIColor clearColor]];
[tit setTextColor:[UIColor whiteColor]];
[tit setText:self.theTitle];
[tit setFont:[UIFont boldSystemFontOfSize:16]];
NSLog(@" wii this is cool:%@",detaildesc);
[self.view addSubview:tit];
label1.text=detaildesc;
label1.numberOfLines=4;
label1.textColor=[UIColor grayColor];
}
return self;
}
我已經添加uiscroll視圖在界面builder.I中號不能dat..could後進行û修改去上面的代碼.... – kingston
@kingston,如果你有一個帶有nib的uiviewcontroller,刪除視圖,添加一個uiscrollview,將uiscrollview作爲uiviewcontroller的視圖鏈接,然後在viewDidLoad中添加下面的代碼:self.scrollView.contentSize = CGSizeMake(320,500);其中500將是整個事物的總高度。 – Jano
我添加上面的行即時通訊得到一個錯誤,說scrollView未聲明..如果我添加滾動視圖作爲IBoutlet和鏈接查看,即使這並不工作 – kingston