प्रत्येक अनुभाग हमेशा एक ही आकार होगा उपयोग करने के लिए अपनी परियोजना के लिए QuartzCore ढांचा जोड़ना सुनिश्चित करें की आवश्यकता होगी? यदि ऐसा है तो आप UITableViewCell को ड्रॉपबुक के साथ आइटम जैसी नोटबुक खींचने के लिए उपclass क्यों नहीं करते?
आप अंधेरे कोनों को प्राप्त करने के लिए UITableView पर एक पारदर्शी UIImageView भी जोड़ सकते हैं।
संपादित करें:
इस आशय थोड़ा मुश्किल है, आप कैसे UIBezierPaths उपयोग करने के लिए इस पर गौर करना चाहते करने जा रहे हैं (http://developer.apple.com/library/IOS/#documentation/UIKit/ संदर्भ/UIBezierPath_class/संदर्भ/Reference.html)।
शीर्ष भाग एक छवि (छल्ले और टैब प्रभाव) हो सकता है। फिर आप drawRect फ़ंक्शन में शेष सेल खींच सकते हैं। (परत में छाया गुणों का उपयोग करने से यह अधिक कुशल है जो UITableViewCell में महत्वपूर्ण है)।
आप अपने UITableViewCell क्लास को ओवरराइड करना और कस्टम drawRect: function को कार्यान्वित करना चाहते हैं।
आपके प्रारंभ करने के लिए कुछ कोड है:
// 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];
}
कोड काफी खींचें और ड्रॉप नहीं है, आप अभी भी सफेद लाइनों को जोड़ने के कुछ आकार ठीक है, और अंतिम सेल और करने के लिए छाया बदलाव करने की जरूरत है बस सही हो। लेकिन यह आपको शुरू करने के लिए पर्याप्त होना चाहिए।
चीयर्स!
लिंक मौजूद नहीं है। – Leena