funktioniert nicht korrekt. addSubview problem
Mir helfen.
addSubview nicht funktioniert.
Ich möchte hinzufügen "ContentView" auf scrollView.
Aber "ContentView" erscheint nicht auf dem Bildschirm.
"ContentView" ist UIView.
Wenn ich auf selbst.view=scrollView von [self.view addSubview:scrollView],
addSubview nicht funktioniert.
Bitte mir beibringen, wie man hinzufügen UIView auf diesem Bildschirm!!
- (void)viewDidLoad {
[super viewDidLoad];
scrollViewMode = ScrollViewModeNotInitialized;
mode = 1;
imageViewArray = [[NSMutableArray alloc] init];
mainStatic = [[MainStatics alloc] init];
[mainStatic setSetting];
NSString* path = [[NSBundle mainBundle] pathForResource:@"Files" ofType:@"plist"];
NSArray* dataFiles = [NSArray arrayWithContentsOfFile:path];
kNumImages = [dataFiles count];
CGRect frame = [UIScreen mainScreen].applicationFrame;
scrollView = [[touchClass alloc] initWithFrame:frame];
scrollView.delegate = self;
scrollView.maximumZoomScale = 5.0f;
scrollView.minimumZoomScale = 1.0f;
[scrollView setBackgroundColor:[UIColor blackColor]];
[scrollView setDelegate:self];
scrollView.delaysContentTouches=NO;
scrollView.userInteractionEnabled = YES;
[scrollView setCanCancelContentTouches:NO];
NSUInteger i;
for (i=0;i<[dataFiles count];i++)
{
UIImage* image = [UIImage imageNamed:[dataFiles objectAtIndex:i]];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.contentMode = UIViewContentModeScaleAspectFit;
imageView.userInteractionEnabled = NO;
CGRect rect = imageView.frame;
rect.size.height = 480;
rect.size.width = 320;
imageView.frame = rect;
imageView.tag = i+1;
[imageViewArray addObject:imageView];
}
self.view = scrollView;
[self setPagingMode];
UIView* contentView;
CGRect scRect = CGRectMake(0, 436, 320, 44);
contentView = [[UIView alloc] initWithFrame:scRect];
[contentView addSubview:toolView];
[self addSubview:contentView];
}
InformationsquelleAutor kyoheialfaromeo2010 | 2010-06-03
Du musst angemeldet sein, um einen Kommentar abzugeben.
Ich verwendete Bild-array in der folgenden Funktion.
toolView ist UIView mit UIToolbar.
So will ich hinzufügen Symbolleiste auf den Bildschirm.
Ja, touchClass ist Unterklasse von UIScrollView.
1.Ich sehe.Ich vergaß dieses release.Danke.
2.OK. Ich veränderte dies.Aber "ContentView" nicht erscheinen.
gibt es einen anderen Grund?
InformationsquelleAutor kyoheialfaromeo2010
Quelle ist nicht klar.
Die Sie nie benutzen array mit UIImageView. Es gibt keine info, was ist toolView etc...
Bitte geben Sie genauere Quelle. Ist
touchClass
eine Unterklasse vonUIScrollView
?Was mir aufgefallen ist in deinem code:
image
undimageView
. Alle diese Bilder imageViews wird zugespielt werden. Am Ende der Schleife sollten Sie[imageView release];
und[image release];
[self addSubview:contentView];
Versuchen[self.view addSubview:contentView];
InformationsquelleAutor OgreSwamp