我的代码是这样的:
- (void)viewDidLoad
{
[self setGridView];
}
-(void)setGridView
{
CGRect frame;
frame .origin.x=0;
frame.origin.y=20;
frame.size.width=GRID_WEIGHT;
frame.size.height=GRID_HEIGHT;
GridView *ObjGridView=[[GridView alloc]initWithFrame:frame];
[[NSBundle mainBundle ] loadNibNamed:@"GridView" owner:ObjGridView options:nil];
[ObjGridView setGridViewFrame:frame];
[self.view addSubview:ObjGridView.GridCellView];
frame .origin.x+=GRID_WEIGHT;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
此代码将子视图添加到视图并设置框架
我的问题:1-当方向(横向或纵向)发生时我如何刷新我的视图,因为我在横向模式下设置了子视图的框架,我也想在我的纵向视图中使用理智的视图。(基本上我在哪里调用这个 -(void)setGridView 委托方法)?
2-我怎么知道,我的子视图超出了视图的范围,以便我可以在我的 setGridView 方法中处理子视图?