Ich habe ein UIScrollVIEW. Es enthält eine Ansicht mit verschiedenen Steuerelementen. Ich habe alle zu einer Ansicht hinzugefügt und dann die Ansicht der UIScrollView hinzugefügt. Der Bildlauf ist nicht aktiviert und der Inhalt ist nicht zentriert. Hier ist der Code:UIScrollVIEW scrollt nicht
- (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;
}
Header-Code:
@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;
Hallo gargo, in der Schnittstelle Builder habe ich diese ContenView -> imagen, fecha, titulo, Text. Aber ScrollView ist nicht im IB. Vielleicht ist das das Problem. Vielen Dank. – theomen
vielleicht ist es standardmäßig nicht scrollbar und Sie sollten es selbst einstellen – Gargo
Sie haben Recht. Gelöst. Danke vielmals. – theomen