Question

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

No correct solution

OTHER TIPS

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];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top