2011-12-02 13 views

उत्तर

4

आप किसी छवि से नया दृश्य बना सकते हैं और फिर उसे सेल कॉलिंग addSubview में जोड़ सकते हैं।

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

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 

     CGRect cornerFrame = CGRectMake(x, y, width, height); 
     UIImageView * corner = [[UIImageView alloc] initWithFrame:cornerFrame]; 
     [corner setImage:[UIImage imageNamed:@"corner.jpg"]]; 

     [cell.contentView addSubview:corner]; 
    } 

    return cell; 
} 
+0

यह ठीक से ... कोशिकाओं पुन: उपयोग करने के काम नहीं करेगा, आप प्रत्येक कोशिका के लिए इनमें से कई जोड़ रहे होंगे अगर आप इसे इस तरह से लागू: यहाँ एक उदाहरण लॉंन्च कोने की स्थापना है। –

+0

यह 'addSubview' को कॉल करने का उदाहरण है। वह जहां चाहें उसका इस्तेमाल कर सकता है। – Dimme

+0

इस विशेष स्थान में यह तोड़ देगा हालांकि :) कोड कोड नमूना से भी बदतर एक चीज खराब कोड नमूना है। –

0

इसकी शायद सिर्फ एक सेल में छवि। कुछ भी फैंसी नहीं, बस मिल का कस्टम मानक UITableViewCell

संबंधित मुद्दे