0

I have an application in landscape mode, now I am adding a view in appdelegate but it's showing as in portrait mode. it is 90 degree rotated

below is my code added in appdelegate

 -(void)addProcessingView{
    UIView*container = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 100)] autorelease];
    container.backgroundColor = [UIColor grayColor];
    UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(100, 0, 400, 100)] autorelease];

  [container addSubview:label];
   UIActivityIndicatorView *active = [[[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 100 , 100)] autorelease];
  [container addSubview:active];
  container.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
  [self.window addSubview:container];
  container.center = self.window.center;
}

See image

enter image description here

Cœur
  • 37,241
  • 25
  • 195
  • 267
Parveen Tyagi
  • 155
  • 1
  • 1
  • 9

1 Answers1

0

I think you have to change the frame size of the view. Replace below line into your code.It will sort out your problem.

 UIView*container = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 500)] autorelease];
Romance
  • 1,416
  • 11
  • 21