안녕하세요 저는 테이블보기에서 하위 메뉴가있는 메뉴를 사용해야합니다. 메뉴 모양은 다음과 같습니다.
1. News ---|1.1 ---|1.2 ---|1.3 2. Weather 3. Ads 4. Cinema
Tableview IOS의 하위 메뉴로 메뉴를 수행하는 방법?
데이터는 메뉴에서 다운로드 할 수 있습니다.
이 메뉴에서 셀을 이동해야합니다.
어떤 프레임 워크가 사용 되었습니까?
안녕하세요 저는 테이블보기에서 하위 메뉴가있는 메뉴를 사용해야합니다. 메뉴 모양은 다음과 같습니다.
1. News ---|1.1 ---|1.2 ---|1.3 2. Weather 3. Ads 4. Cinema
Tableview IOS의 하위 메뉴로 메뉴를 수행하는 방법?
데이터는 메뉴에서 다운로드 할 수 있습니다.
이 메뉴에서 셀을 이동해야합니다.
어떤 프레임 워크가 사용 되었습니까?
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return self.menus.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 55;;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 70;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [[self.menu objectAtIndex:section] objectForKey:@"submenus"];
}
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 70)];
headerView.backgroundcolor = [UIColor clearcolor];
UILabel *menuTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 2, tableView.frame.size.width - 5, 60)];
menuTitleLabel.backgroundColor = [UIColor clearColor];
menuTitleLabel.textColor = [UIColor colorWithRed:68.0/255.0 green:68.0/255.0 blue:68.0/255.0 alpha:1.0];;
menuTitleLabel.text = [[[self.menus objectAtIndex:section] objectForKey:@"title"] uppercaseString];
menuTitleLabel.font = [UIFont fontWithName:@"Roboto-Bold" size:16.0];
[menuTitleLabel setAdjustsFontSizeToFitWidth:YES];
[headerView addSubview:menuTitleLabel];
return headerView;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray *submenuArray = [[self.menus objectAtIndex:indexPath.section] objectForKey:@"submenus"];;
static NSString *CellIdentifier = @"MenuCell";
MenuCell *cell = (MenuCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"MenuCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
cell.backgroundColor = [UIColor clearColor];
}
cell.title.backgroundColor = [UIColor clearColor];
cell.title.font = [UIFont fontWithName:@"Roboto-Bold" size:16.0];
cell.title.text = [subMenuArray objectAtIndex:indexPath.row]objectForKey:@"title"];
cell.title.textColor = [UIColor colorWithRed:68.0/255.0 green:68.0/255.0 blue:68.0/255.0 alpha:1.0];
return cell;
}
, 배열을 메뉴로 서버에서 메뉴를로드 MenuCell있는 UITableViewCell 사용자 정의 만들기 헤더가 포함됩니다에 대한 tablew.The보기를 다시로드하여 뉴스, 날씨 등과 같은 필수 데이터 및 행 방법의 셀에서 각각 하위 메뉴 준비 – Nassif
tableView:indentationLevelForRowAtIndexPath:
대리자 메서드를 사용하십시오. 각 메뉴 섹션마다 다른 표 섹션을 사용하고 indexPath.row > 0
을 기준으로 들여 쓰기를 설정하십시오 (메뉴에서 2 단계로 가정).
답변을 시도해주세요. – Nassif
검색 가능한 단어 목록 및 메뉴가 nsdictionary입니까? – wysio90
내 실수는 대답을 편집 한 것입니다. 당신의 메뉴 포맷은 무엇입니까 – Nassif