我有一个选择服务中的单选按钮的问题。我有3个单选按钮的问题。在问题1中,我有3个单选按钮(John,Mike,David),并且插座连接到groupButtons(_hasNameRadioButton)。以下是服务Radiobutton应根据服务数据选择Objective-C(重新发布)
{
"DataTable": [
{
"EmpNames": {
"empName": "David",
"empid": "243",
"empEdu": "B.Tech"
}
}
]
}
我该如何设置单选按钮给大卫。
这是我试过的。但不能有任何想法如何做
#pragma mark - MRConnection Delegate Methods
- (void)jsonData:(NSDictionary *)jsonDict
{
[SVProgressHUD dismiss];
NSMutableArray *jsonArr;
jsonArr=[jsonDict objectForKey:@"DataTable"];
if (![jsonArr isEqual:[NSNull null]]) {
if ([[jsonArr objectAtIndex:0] objectForKey:@"EmpNames"]) {
NSMutableDictionary *userDict=[[jsonArr objectAtIndex:0] objectForKey:@"EmpNames"];
_txtempId.text=[userDict objectForKey:@"empid"];
_txtempEdu.text=[userDict objectForKey:@"empEdu"];
groupButtons
NSMutableString *str = [NSMutableString stringWithFormat:@"%@",[userDict objectForKey:@"empName"]];
if ([str isEqualToString:@"John"]) {
[_hasNameRadioButton setSelected:YES];
}
else if ([str isEqualToString:@"Mike"]) {
[_hasNameRadioButton setSelected:YES];
}
else if ([str isEqualToString:@"David"]) {
[_hasNameRadioButton setSelected:YES];
}
}
}
}
这是什么意思“在问题1我有3个单选按钮(约翰·麦克,大卫)和出口连接到groupButtons(_hasNameRadioButton)。下面是服务“? 什么是groupButtons?在连接插座的位置添加代码。 –
这是什么hasNameRadioButton? – vaibby