【发布时间】:2015-11-12 12:57:47
【问题描述】:
viewcontroller.h 文件
@interface ViewController : UIViewController<kDropDownListViewDelegate>
{
NSArray *arryList;
NSArray *arryList1;
DropDownListView * Dropobj;
}
- (IBAction)DropDownPressed:(id)sender;
- (IBAction)DropDownPressed1:(id)sender;
@property (strong, nonatomic) IBOutlet UILabel *lblSelectedCountryNames;
@property (strong, nonatomic) IBOutlet UILabel *lblSelectedCountryNames1;
@end
viewcontroller.m 文件
- (void)viewDidLoad
{
[super viewDidLoad];
arryList=@[@"India",@"Swaziland",@"Africa",@"Australlia",@"Pakistan"];
arryList1=@[@"India1",@"Swaziland1",@"Africa1",@"Australlia1",@"Pakistan"];
}
- (void)DropDownListView:(DropDownListView *)dropdownListView didSelectedIndex:(NSInteger)anIndex
{
/*----------------Get Selected Value[Single selection]-----------------*/
_lblSelectedCountryNames.text=[arryList objectAtIndex:anIndex];
_lblSelectedCountryNames1.text=[arryList1 objectAtIndex:anIndex];
}
- (IBAction)DropDownPressed:(id)sender
{
[Dropobj fadeOut];
[self showPopUpWithTitle:@"Select Country" withOption:arryList xy:CGPointMake(16, 58) size:CGSizeMake(287, 330) isMultiple:NO];
}
- (IBAction)DropDownPressed1:(id)sender
{
[Dropobj fadeOut];
[self showPopUpWithTitle:@"Select " withOption:arryList1 xy:CGPointMake(16, 58) size:CGSizeMake(287, 330) isMultiple:NO];
}
单击 DropDownPressed1 时,它不会与 arrylist1 一起加载……而不是与 arrylist 一起加载……如果我选择 valaue 示例 india……这就是两个标签中显示的值。 ....如何纠正这些问题...如果不清楚,请提供您的邮箱 ..我会提前发送我的示例项目...
【问题讨论】:
-
检查
DropDownPressed1和DropDownPressed的连接。你试过调试吗? -
如果我同时单击按下的按钮操作...加载相同的 arrylist 并且如果我选择值 ....相似的值将显示在两个标签中..如何填充正确的数组列表并在标签中显示正确的值。
-
你确定它同时进入 DropDownPressed1 和 DropDownPressed 吗?
-
@ anhtu 是的,我检查了连接...现在它已正确加载但现在如果我选择印度,则单击下拉菜单...它也会自动显示在 _lblSelectedCountryNames1 中...如何避免这种情况...
-
- (void)DropDownListView:(DropDownListView *)dropdownListView didSelectedIndex:(NSInteger)anIndex { /*----------------Get Selected Value[Single selection]-----------------*/ _lblSelectedCountryNames.text=[arryList objectAtIndex:anIndex]; _lblSelectedCountryNames1.text=[arryList1 objectAtIndex:anIndex]; }随意修改这个函数。如果您点击 DropDownPressed1 或 DropDownPressed,您可以使用 1 个变量进行检查。
标签: ios cocoa-touch uibutton