Czy każda sekcja zawsze taki sam rozmiar? Jeśli tak, to czy nie podklaskujecie UITableViewCell, aby narysować przedmiot podobny do notatnika z dołączonym cieniem?
Możesz także dodać przezroczysty UIImageView przez UITableView, aby uzyskać przyciemnione rogi.
EDIT:
Efekt ten jest nieco skomplikowane, masz zamiar przyjrzeć się, jak korzystać z UIBezierPaths (http://developer.apple.com/library/IOS/#documentation/UIKit/ Odniesienie/UIBezierPath_class/Reference/Reference.html).
Górną częścią może być obraz (efekt pierścieni i tabulatora). Następnie można narysować resztę komórki w funkcji drawRect. (Jest to bardziej wydajne niż użycie właściwości cienia w warstwie, która jest ważna w UITableViewCell).
Będziesz chciał nadpisać klasę UITableViewCell i zaimplementować niestandardową funkcję drawRect:
Oto niektóre kodu do należy zacząć:
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
/* Draw top image here */
//now draw the background of the cell.
UIBezierPath *path1 = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 320, 50)];
[[UIColor grayColor] set];
[path1 fill];
UIBezierPath *path2 = [UIBezierPath bezierPathWithRect:CGRectMake(0, 52, 320, 50)];
[[UIColor whiteColor] set];
[path2 fill];
UIBezierPath *path3 = [UIBezierPath bezierPathWithRect:CGRectMake(0, 104, 320, 50)];
[[UIColor grayColor] set];
[path3 fill];
UIBezierPath *path4 = [UIBezierPath bezierPathWithRect:CGRectMake(0, 156, 320, 50)];
[[UIColor whiteColor] set];
[path4 fill];
//and so on...
//Let's draw the shadow behind the last portion of the cell.
UIBezierPath *shadow = [UIBezierPath bezierPathWithRect:CGRectMake(0, 208, 320, 52)];
[[UIColor darkGrayColor] set];
[shadow fill];
//Finally, here's the last cell with a curved bottom
UIBezierPath *path5 = [UIBezierPath bezierPath];
[path5 moveToPoint:CGPointMake(0, 208)];
[path5 addLineToPoint:CGPointMake(320, 208)];
[path5 addLineToPoint:CGPointMake(320, 258)];
[path5 addCurveToPoint:CGPointMake(0, 258) controlPoint1:CGPointMake(160, 254) controlPoint2:CGPointMake(160, 254)];
[[UIColor grayColor] set];
[path5 fill];
}
Kod nie jest całkiem przeciągnij i upuść, trzeba jeszcze dodać białe linie, naprawić niektóre rozmiary i dostrojenia ostatnią komórkę i cień do być w porządku. Ale powinno wystarczyć, aby zacząć.
Pozdrawiam!
Link nie istnieje. – Leena