Hallo,
und noch ein Problem quält mich.
Ich habe ein View, dass sich in ein ScrollView und ein TableView aufteilt. Das Scrollview will aber nicht so recht. Das Scrollview enthält das titleCV, (ein normales View mit dynamischen Button).
Ich habe darauf geachtet, vom Scrollview sowohl Contentsize als auch Frame zu setzen. Das Scrollview wird ja angezeigt, aber erst wenn die Methode buildListOfChannels das zweite Mal aufgerufen wird. Nach dem ersten Aufruf sehe ich nur ein weißes Feld.
Habe ich eine andere Eigenart übersehen?
Alles anzeigen
Vielen Dank für die Hilfe .-),
Juji
und noch ein Problem quält mich.
Ich habe ein View, dass sich in ein ScrollView und ein TableView aufteilt. Das Scrollview will aber nicht so recht. Das Scrollview enthält das titleCV, (ein normales View mit dynamischen Button).
Ich habe darauf geachtet, vom Scrollview sowohl Contentsize als auch Frame zu setzen. Das Scrollview wird ja angezeigt, aber erst wenn die Methode buildListOfChannels das zweite Mal aufgerufen wird. Nach dem ersten Aufruf sehe ich nur ein weißes Feld.
Habe ich eine andere Eigenart übersehen?
Quellcode
- -(void)buildListOfChannels
- {
- //remove views from titleCV
- for(UIView *subview in [self.titleCV subviews]) {
- [subview removeFromSuperview];
- }
- [titleCV removeFromSuperview];
- NSLog(@"buildListOfChannels");
- //button config
- //set Contentsize
- CGFloat scrollViewWidth = 0.0f;
- CGFloat startX = 20.0f;
- if (self.model.allChannelList!=nil && [self.model countOfAllChannelList]>0)
- {
- for (UIButton* view in self.titleCV.subviews)
- {
- if (!view.hidden)
- {
- CGFloat x = startX;
- CGFloat y = 6;
- CGFloat h = 37.0f;
- CGFloat w = ([view.titleLabel.text length])*10.0;
- if(w<40) w = 40;
- view.frame = CGRectMake(startX, y, w, h);
- if (x + w > scrollViewWidth) scrollViewWidth = x + w;
- startX = startX + w + 10.0f;
- }
- }
- }else scrollViewWidth=300;
- self.titleCV.frame = CGRectMake(0, 0, scrollViewWidth+20, 50);
- if (scrollViewWidth >= 320) [self.scrollview setContentSize:(CGSizeMake(scrollViewWidth+20.0f, 50))];
- else [self.scrollview setContentSize:(CGSizeMake(320, 50))];
- self.scrollview.frame = CGRectMake(0, 0, 320, 50);
- //add titleCV to scrollview
- [self.scrollview addSubview:self.titleCV];
- [self.scrollview setScrollEnabled:YES];
- }
Vielen Dank für die Hilfe .-),
Juji