2016-06-15 5 views
0

작은 질문 있습니다. 첨부 된 이미지와 같이 슬라이딩 메뉴에서 프로필 사진과 UserFullName, State 및 Country를 단일 레이블에 동적으로 표시하는 방법. enter image description here TIA슬라이딩 메뉴에 이미지 표시

+2

목록 (표보기)에 데이터를 표시하는 경우 uitable보기 사용자 정의 셀에서 수행 할 수 있습니다. – user3182143

답변

0

UserFullName, StateCountry을 단일 레이블로 설정할 수 없습니다. 두 개의 라벨을 사용하고 첨부 된 그림과 같은 이미지를 설정하고 모서리를 둥글게 말아야합니다. 예를 들어

:

Imageview.layer.cornerRadius=10; 
[Imageview.layer setMasksToBounds:YES]; 
0

이 같은 디자인 tablecell 또는 당신은 또한 같은 같은 사이드 바에서 UIView을 디자인 할 수 있습니다.

프로그래밍 방식으로 이미지의 corner radius을 설정하면 모양이 둥글다.

enter image description here

+0

이것은 이미 완료되었습니다. 하지만 나는 이미지 뷰에서 프로필 사진, 첫 번째 레이블에 userfullname을 표시해야하며 주 & 국가는 서비스의 다른 레이블에 표시해야합니다. – prasad

0

예는 하나 개의 레이블에있는 모든이

[_demolabel setText:[NSString stringWithFormat:@" UserFullName \n State Country"]]; 

을 이미지 뷰

에 기대와 라벨의 높이와 폭을 위해 적절한 논리를 적용 설정할 수 있습니다.

0

레이블에 이미지를 추가 할 수 없으므로 이미지 용으로 별도의 콘센트가 필요합니다.

단일 레이블로 표시하는 것은 약간 까다 롭습니다. NSAttributted Text를 사용해야합니다. \ n을 추가해야하는 사용자 이름을 읽은 후 다음 행 데이터를 자릅니다.

label.numberOFLines = 0; (레이블을 설정해야합니다)

최상의 옵션 사용자 이름에 두 개의 레이블 1을 사용하고 다음은 위치에 적절한 자동 레이아웃과 간격을 두는 것입니다. 그러면 작업이 완료됩니다.

0

를 사용하여 사용자 정의 셀 당신은

먼저 당신이 당신이 (또한 연결 이미지 뷰, 이름 라벨 및 staecountry 레이블을 설정하기 위해 드래그 필요 사용자 정의 jQuery과 Cell.In의 XIB 파일을 만드는 데 필요한 이미지, 이름, 주 및 국가를 얻을 수 있습니다 .h).

있는 TableView 데이터 소스 방법에

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{ 
    return 1; 
} 
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
    return yourArray.count; 
} 
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    CustomTableViewCell *cell = (CustomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"cell"]; 
    if (cell == nil) { 
    NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomTableViewCell" owner:self options:nil]; 
    cell = [nib objectAtIndex:0]; 
    } 


    cell.imgViewDetail.image = [UIImage imageNamed:@"imagename.png"]; 


    cell.imgView.layer.borderWidth = 2.0; 
    cell.imgView.layer.cornerRadius = cell.yourImageView.frame.size.height /2; 
    cell.imgView.layer.masksToBounds = YES; 


    cell.labelName.text = @"James Stevens"; 
    cell.labelStateCountry.text = [NSString stringWithFormat:@"%@%@",@"Sydney",@"Australia"]; 
    return cell; 
} 
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    return 80; 
} 

중요 원

#import <QuartzCore/QuartzCore.h> 

을 형성하는 Quartzcore 프레임 워크를 가져올하십시오 - 당신은 200,200 또는 100,100 또는 50,50로 이미지 뷰의 폭과 높이를 제공해야 .... imageView를 원으로 설정했을 때 동등한 너비와 높이를주고 싶다면