문제

테이블 뷰 셀에 이미지보기를 삽입했습니다.그리고 나는 그것이 이미지를 전체 화면으로 확대하고 싶습니다.그것이 너무 작으므로. 나를 도와주세요.대단히 감사합니다! 이것은 아래의 코드입니다 :

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:    (NSIndexPath *)indexPath{
static NSString *identifier = @"identifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];

if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault   reuseIdentifier:identifier];


    //
    cell.selectionStyle =UITableViewCellSelectionStyleNone;
    //set the background
    cell.backgroundColor = [UIColor clearColor];

}else {

    [[cell.contentView     subviews]makeObjectsPerformSelector:@selector(removeFromSuperview)];

}

NSArray *images = @[@"po", @"po", @"po", @"po",@"po", @"po", @"po", @"po", @"po", @"po",@"po", @"po", @"po", @"po", @"po", @"po",@"po", @"po", @"po", @"po", @"po", @"po", @"po",@"po", @"po", @"po", @"po", @"po", @"po",@"po", @"po", @"po", @"po", @"po", @"po",@"po", @"po", @"po"];

//and an text view 
UITextView *hisText = [[UITextView alloc] init];
hisText.frame = CGRectMake(100, 110, 600, 350);
[hisText setFont:[UIFont fontWithName:@"HelveticaNeue" size:14]];
hisText.textColor = [UIColor blackColor];
hisText.editable = NO;


//set the image view 
UIImageView *hisImg =[[UIImageView alloc] init];
hisImg.frame = CGRectMake(106, 170, 575, 140);


switch (indexPath.row) {
    case 0:
        hisText.frame = CGRectMake(100, 120, 600, 500);
        hisText.text = @"Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.”";
        hisImg.image = [UIImage imageNamed:@"1928-1.jpg"];
        [cell.contentView addSubview:hisText];
        [cell.contentView addSubview:hisImg];
        break;
    case 1:
        hisText.frame = CGRectMake(100, 155, 600, 405);
        hisText.text = @"Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.”";
        [cell.contentView addSubview:hisText];
        break;
    default:
        break;
}//


cell.imageView.image = [UIImage imageNamed:images[indexPath.row]];

return cell;
}
.

누군가가 나를 도울 수 있습니다. 여기에 누구나?

도움이 되었습니까?

해결책

클릭 이벤트에서 수행 할 수 있습니다.didSelectRowAtIndexPath에서 인덱스를 가져올 수 있습니다.그런 다음 이미지보기를 가져 와서 테이블보기의 서브 뷰로 추가하십시오.당신이 이해할 수 있기를 바랍니다.:)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top