سؤال

ولقد تقدمت UITableView تجميعها في نظام التشغيل اي فون 3.0 الذي يشبه الصورة اليسرى. والنتيجة هي الصورة الصحيحة في OS 3.1.

ووimageView تحت الفواصل.

ولقد حاول أن يضع عرض المحتويات في الجبهة. مدى ملاءمة separatorStyle يبدو تجاهل عندما tableView في أسلوب تجميع (لرسم فاصل نفسي). تغيير لون فاصل يعطي سلاسل النتائج.

وشكرا لمساعدتكم!

وتحرير: هذا هو رمز مع أي تغيير يطرأ:

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.font = [UIFont boldSystemFontOfSize:18.0];
}

cell.textLabel.text = [[metro.arretDirection objectAtIndex:indexPath.row] name];

NSString* name;
if (indexPath.row == 0) {
    name = @"Begining";
}
else if (indexPath.row + 1 == [metro.arretDirection count]) {
    name = @"End";
}
else {
    if ([[[metro.arretDirection objectAtIndex:indexPath.row] lines] count]== 1) name = @"Little";
    else name = @"Big";
}

UIImage* metroImage = [[UIImage alloc] initWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%i%@.png", metro.metroNumber, name]]];
cell.imageView.image = metroImage;
[metroImage release];

return cell;
هل كانت مفيدة؟

المحلول 2

وكان الجواب في الواقع بسيط جدا، مجرد إضافة UIImageView في الخلية مكان بشكل صحيح بدلا من استخدام بنيت في imageView.

نصائح أخرى

في الخلية محاولة وضع <لأ href = "http://developer.apple.com/library/ios/documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instp/UIView / clipsToBounds "يختلط =" نوفولو "> clipsToBounds للNO. على سبيل المثال cell.clipsToBounds = NO;

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top