2012-03-31 17 views
0

私はUIScrollVIewを持っています。さまざまなコントロールを含むビューが含まれています。それらをすべてビューに追加してから、ビューをUIScrollViewに追加しました。スクロールはアクティブ化されず、コンテンツは中央に配置されません。UIScrollVIewがスクロールしていません

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    CGRect frame = texto.frame; 
    frame.size.height = texto.contentSize.height; 
    texto.frame = frame; 

    [self configureView]; 

    [self.scrollView addSubview:self.contentView]; 
    self.scrollView.contentSize = self.contentView.bounds.size; 
    self.contentView.userInteractionEnabled= NO; 
    self.scrollView.userInteractionEnabled=TRUE; 

} 

-(void)configureView{ 

    self.texto.text = self.newsDetail.text; 

    NSData *imageData= [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:self.newsDetail.image_large]]; 

    self.imagen.image = [UIImage imageWithData:imageData]; 

    self.fecha.text = self.newsDetail.datePublish; 

    self.titulo.text = self.newsDetail.title; 


} 

ヘッダーコード:私はあなたがコードの変数を使用してUIScrollViewのをリンクしていることがわかり

@interface detailNewsController : UIViewController{ 

UIScrollView * __weak scrollView; 
UIView  * __weak contentView; 

} 

@property (nonatomic, strong) news *newsDetail; 

@property (weak, nonatomic) IBOutlet UIScrollView *scrollView; 

@property (weak, nonatomic) IBOutlet UIView * contentView; 

@property (strong, nonatomic) IBOutlet UIImageView *imagen; 

@property (strong, nonatomic) IBOutlet UILabel *fecha; 
@property (strong, nonatomic) IBOutlet UILabel *titulo; 

@property (strong, nonatomic) IBOutlet UITextView *texto; 

-(void) configureView; 

答えて

0

ここでは、コードです。あなたが垂直スクロールを有効にしている場合は、インタフェースビルダーをチェックインしてください(または必要な場合は水平の場合)

+0

こんにちは、私はこのContenView - > imagen、fecha、titulo、textを持っています。しかし、ScrollViewはIBにはありません。たぶんこれが問題です。ありがとう。 – theomen

+0

おそらくデフォルトではスクロール可能ではないので、あなた自身で設定する必要があります – Gargo

+0

あなたは正しいです。解決済み。どうもありがとう。 – theomen

関連する問題