如何添加垂直滚动视图

时间:2011-09-26 13:57:15

标签: objective-c xcode

我有一个包含按钮和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;
   }

enter image description here

2 个答案:

答案 0 :(得分:1)

将UIScrollview放在选项卡中,然后将UIScrollView的contentSize调整为所有控件的总高度。

答案 1 :(得分:0)

在contentSize中,您必须增加Y值