- Registriert
- 28.06.08
- Beiträge
- 104
Hallo,
ich habe folgendes Problem in meiner App. Da wir keinen Interface Builder mehr nutzen müssen wir logischerweise alle Elemente im Code erstellen und platzieren. Da wir auch noch zwischen Landscape und Portrait Modus unterscheiden wollen, habe ich folgende Struktur entwickelt:
Wenn das im Simulator teste funktioniert es einwandfrei, jedoch auf dem iPhone wird keine der beinen Orientations festgestellt, also wird nichts angezeigt.
Hab ich irgendwas falsch gemacht? Wie überprüft ihr wie das iPhone gehalten wird?
Edit: Jetzt auch mit Code-Blöcken, tut mir Leid.
ich habe folgendes Problem in meiner App. Da wir keinen Interface Builder mehr nutzen müssen wir logischerweise alle Elemente im Code erstellen und platzieren. Da wir auch noch zwischen Landscape und Portrait Modus unterscheiden wollen, habe ich folgende Struktur entwickelt:
Code:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
if( ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) || ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight) ){
self.DetailButton.frame = CGRectMake(180,220,120,40);
self.pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,55,480,216)];
self.Label = [[UITextView alloc] initWithFrame:CGRectMake(40,0,400,40)];
self.Label2 = [[UITextView alloc] initWithFrame:CGRectMake(0,20,480,40)];
}
else if( ([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait) || ([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortraitUpsideDown) ){
self.DetailButton.frame = CGRectMake(100,360,120,40);
self.pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,105,320,216)];
self.Label = [[UITextView alloc] initWithFrame:CGRectMake(10,0,300,60)];
self.Label2 = [[UITextView alloc] initWithFrame:CGRectMake(10,50,300,60)];
}
[...]
}
return self;
}
Wenn das im Simulator teste funktioniert es einwandfrei, jedoch auf dem iPhone wird keine der beinen Orientations festgestellt, also wird nichts angezeigt.
Hab ich irgendwas falsch gemacht? Wie überprüft ihr wie das iPhone gehalten wird?
Edit: Jetzt auch mit Code-Blöcken, tut mir Leid.
Zuletzt bearbeitet: