Rasmni UITableView - xcode uyasiga yuklang

UITableView tekshiruviga quyidagicha yuklayotgan 2 ta ma'lumot majmuasi mavjud:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }

    if(indexPath.section == 0)

        cell.textLabel.text = [arryTableData objectAtIndex:indexPath.row];

    else
        cell.textLabel.text = [arryTableActions objectAtIndex:indexPath.row];
    cell.accessoryType = UITableViewCellAccessoryNone;
    return cell;
}

Birinchi hujayradan joyning tasviriga ega bo'lish uchun yuqoridagi ketma-ketlikni (arryTableData) xohlayman.

arryTableData = [[NSArray alloc] initWithObjects:[NSString stringWithFormat:@"%@", locName],
                            [NSString stringWithFormat:@"%@", locPhone],
                            @"Address Info",
                            @"Access Icons",
                            nil];

Shunday ekan, locName oldin locImage ning u yerda bo'lishini xohlayman. Tasvirni qatorga qanday yuklay olaman va keyin uni kameraga ko'rsatishim mumkin?

Rahmat

Tom

0

1 javoblar

Agar NSIrrayga UIImage yuklamaslikni tavsiya qilaman. Faqat "ImageName" (fayl nomi) ni NSArray-ga NSString sifatida qo'shing.

Tasviringizni ko'rsatish kerak bo'lsa, buni bajaring:

UIImage * image = [UIImage imageNamed:[arryTableImage objectAtIndex:indexPath.row]];
cell.imageView.image = image;

NSStringni NSArray arryTableImage-ga yuklashingiz kerak.

To'rtta sizmi?

5
qo'shib qo'ydi
Buning uchun katta rahmat. Uni faqat birinchi satrda ko'rsatishga va faqat rasmni ko'rsatishga sozlashim mumkin, boshqa hech narsa yo'q (asosan, bu joy uchun logotip va uni juda katta ko'rsatishni xohlayman)
qo'shib qo'ydi muallif TMB87, manba
+1 Mumkin bo'lsa, rasmga kerak bo'lmaguncha xotirani urishdan qochish uchun rasm joylarini saqlashni afzal ko'raman. Eslatma: UIImage-ning imageNamed: usuli yordamida tasvirni keshlash mumkin. Bu vaziyatga qarab yaxshi. Katta rasmingiz faqat bir marta ishlatmoqchi bo'lsangiz, keshlashni oldini olish uchun uning o'rniga imageWithContentsOfFile: dan foydalaning.
qo'shib qo'ydi muallif Sam, manba