我有一个应用程序,其中我有一个uiview上有两个按钮。我已经设置了我的uiview框架。如何获得uiview显示在按钮点击iphone
newview = [[UIView alloc]initWithFrame:CGRectMake(0,350,320,70)];
并将其设置为我的主要观点
[self.view addSubview:newview];
然后我添加了两个按钮,这个新的观点。新视图右侧的新按钮和其他按钮上的一个按钮。
这是我的按钮
leftnavbutton= [[UIButton buttonWithType:UIButtonTypeCustom] retain];
leftnavbutton.backgroundColor = [UIColor clearColor];
[leftnavbutton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal ];
UIImage *buttonImageleft = [UIImage imageNamed:@"previous_large.png"];
//UIImage *strechableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[leftnavbutton setBackgroundImage:buttonImageleft forState:UIControlStateNormal];
[leftnavbutton addTarget:self action:@selector(playAction:) forControlEvents:UIControlEventTouchUpInside];
[leftnavbutton setFrame:CGRectMake(23, 28, 8, 44)];
[newview addSubview:leftnavbutton];
rightnavbutton= [[UIButton buttonWithType:UIButtonTypeCustom] retain];
rightnavbutton.backgroundColor = [UIColor clearColor];
[rightnavbutton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal ];
UIImage *buttonImageright = [UIImage imageNamed:@"next_large.png"];
//UIImage *strechableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[rightnavbutton setBackgroundImage:buttonImageright forState:UIControlStateNormal];
[rightnavbutton addTarget:self action:@selector(play:) forControlEvents:UIControlEventTouchUpInside];
[rightnavbutton setFrame:CGRectMake(275, 28, 8, 44)];
[newview addSubview:rightnavbutton];
代码,所以现在我想,当我对这些按钮点击。一种新观点应该取代我的新观点。 例如,现在当我在新视图中运行我的应用程序时,将显示当前从xml获取的条件。所以当我点击右边的按钮时,应该打开一个新的视图,它应该获取forecat条件标签fron xml并显示在它上面,当我点击右边的按钮时它应该再次显示当前的条件。即它应该在循环中。如果我点击左边的按钮,则应显示预测条件。这怎么可能?
您是否实施了播放和播放操作?对于每个视图也有更好的控制器。 –
@praveen不,我没有实施游戏动作 – Rani
视图控制器会工作得更好,并且更容易实现。试试吧...... –