我在横向模式下有一个应用程序,现在我在appdelegate中添加一个视图,但它在纵向模式下显示。旋转90度
下面是我在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;
}
见图片
答案 0 :(得分:0)
我认为您必须更改视图的帧大小。将以下行替换为您的代码。它将解决您的问题。
UIView*container = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 500)] autorelease];