0
자, 이제 IB에서 만든 사용자 정의 UIView의 X 번호를 만듭니다. 그리드와 같은 형태로 생성하고 설정해야합니다 웹 서비스 호출의 응답에 따라 개별 특성 ...iOS : 여러 사용자 정의보기 객체에 변수 설정
어떻게 다른 UIViews을 반복하고 변수를 설정하는 것입니다 함께 내가하는 데 문제 부분 ...
내가 꽤 있어요 솔루션은 정말 간단하지만 지금 당분간 맹목적으로 쳐다보고 있습니다 ...
다음 부분 :
if([theStatus.groupName isEqualToString:groupEntry.groupNameLabel.text])
{
여기에 전체 방법 :
- (void)receivedGroups
{
int rows, columns;
if([groupConnection.groupsArray count] <= 4)
{
rows = 1;
columns = [groupConnection.groupsArray count];
} else if([groupConnection.groupsArray count] >= 5 && [groupConnection.groupsArray count] <= 8)
{
rows = 2;
columns = ([groupConnection.groupsArray count] + 1)/ 2;
} else
{
rows = 3;
columns = ([groupConnection.groupsArray count] + 2)/ 3;
}
int number = 0;
for(int j=1; j < columns+1; j++)
{
for(int k=0; k < rows; k++)
{
// Only create the number of groups that match the number of entries in our array
if(number < [groupConnection.groupsArray count])
{
// Create an instance of the group view
GroupEntry *groupEntry = [[GroupEntry alloc] initWithFrame:CGRectMake(230*j, 250*k, 180, 233)];
// Add it to the view
[self.view addSubview:groupEntry];
// Get the group
GetGroupsActive *theGroups = [groupConnection.groupsArray objectAtIndex:number];
groupEntry.groupNameLabel.text = theGroups.groupName;
for(int i=0; i<[statusConnection.statusArray count]; i++)
{
CurrentStatus *theStatus = [statusConnection.statusArray objectAtIndex:i];
if([theStatus.groupName isEqualToString:groupEntry.groupNameLabel.text])
{
//allChildren++;
switch(theStatus.currentStatus)
{
case 0:
//childrenSick++;
break;
case 1:
//childrenVacation++;
break;
case 2:
//childrenPresent++;
break;
case 3:
//childrenOut++;
break;
case 4:
//childrenTour++;
break;
default:
break;
}
}
}
NSString *allLabelText = [NSString stringWithFormat:@"%i", allChildren];
NSString *sickLabelText = [NSString stringWithFormat:@"%i", childrenSick];
NSString *vacationLabelText = [NSString stringWithFormat:@"%i", childrenVacation];
NSString *presentLabelText = [NSString stringWithFormat:@"%i", childrenPresent];
NSString *outLabelText = [NSString stringWithFormat:@"%i", childrenOut];
NSString *tripLabelText = [NSString stringWithFormat:@"%i", childrenTour];
groupEntry.sickLabelNumber.text = sickLabelText;
groupEntry.presentLabelNumber.text = presentLabelText;
groupEntry.numberLabelNumber.text = allLabelText;
groupEntry.tripLabelNumber.text = tripLabelText;
groupEntry.outLabelNumber.text = outLabelText;
groupEntry.vacationLabelNumber.text = vacationLabelText;
// Create the buttons to handle button press
UIButton *childButton = [UIButton buttonWithType:UIButtonTypeCustom];
childButton.frame = CGRectMake(230*j, 250*k, 180, 233);
// Set an identity tag, so we can recognize it during button press
childButton.tag = theGroups.ID;
// When EventTouchUpInside, send an action to groupSelected:
[childButton addTarget:self action:@selector(groupSelected:) forControlEvents:UIControlEventTouchUpInside];
// Add it to the view
[self.view addSubview:childButton];
}
number++;
}
}
}
나는'NSArray * subviews = [self.view subviews]로 시도하고있다. (GroupEntry * 서브 뷰의 서브 뷰) { }에 대한 은'하지만이 때문에 캐치되지 않는 예외 'NSInvalidArgumentException'응용 프로그램 종료, 이유와 충돌 계속 : - : – user969043
당신의 하위 뷰가 '[있는 UIButton sickLabelNumber] 알 수없는 선택기 인스턴스 0x18bbb0로 전송' 메서드 "sickLabelNumber"는 무엇입니까? – Vignesh
그래, 내 하위보기에는 sickLabelNumber – user969043