Iphone 多按钮、多视图的相同子视图
在我的应用程序中,我有4个uibutton。单击每个按钮显示子视图包含学习和播放选项。单击时,是否希望显示不同的视图取决于uibutton选择。下面是我的代码。请帮助我执行不同的点击查看选项Iphone 多按钮、多视图的相同子视图,iphone,ios,uibutton,Iphone,Ios,Uibutton,在我的应用程序中,我有4个uibutton。单击每个按钮显示子视图包含学习和播放选项。单击时,是否希望显示不同的视图取决于uibutton选择。下面是我的代码。请帮助我执行不同的点击查看选项 -(IBAction)animals { //UIAlertView *alert4=[[UIAlertView alloc]initWithTitle:@"" message:@"" delegate:self cancelButtonTitle:nil otherButtonTitles:@"LEA
-(IBAction)animals
{
//UIAlertView *alert4=[[UIAlertView alloc]initWithTitle:@"" message:@"" delegate:self cancelButtonTitle:nil otherButtonTitles:@"LEARN",@"PLAY",@"CANCEL",nil];
//alert4.tag = 4;
//[alert4 show];///when it was in uialert view
CGPoint point = [tap locationInView:self.birdsbut];
pv = [PopoverView showPopoverAtPoint:point inView:movingview withContentView:alertvu delegate:self];
}
-(IBAction)birds
{
CGPoint point = [tap locationInView:self.birdsbut];
pv = [PopoverView showPopoverAtPoint:point inView:movingview withContentView:alertvu delegate:self];
}
-(IBAction)direct
{
CGPoint point = [tap locationInView:self.birdsbut];
pv = [PopoverView showPopoverAtPoint:point inView:movingview withContentView:alertvu delegate:self];
}
-(IBAction)fruit
{
CGPoint point = [tap locationInView:self.birdsbut];
pv = [PopoverView showPopoverAtPoint:point inView:movingview withContentView:alertvu delegate:self];
}
要在同一次单击中执行多视图选项,我应该添加什么?为所有按钮设置标记(唯一),然后将它们绑定到touchUpInside中的同一事件(iAction)。
在下面的情况下,将所有这些绑定到事件动物:
-(IBAction) animals: (id) sender;
===================================
-(IBAction) animals: (id) sender {
NSLog(@"User clicked %@", sender);
// Do something here with the variable 'sender'
if(sender.tag==1)
{
enter code here
}
else if (sender.tag==2)
{
enter code here
}
}
按钮和UIAlertView之间有什么关系?你现在想要什么?@MidhunMP在我使用uialertview之前,现在我将其更改为popover视图。因此,每次单击pop-over按钮时我应该做什么更改这里的开关/案例会更好。