• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UITableCellView width decreases when scrolling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UITableCellView width decreases when scrolling


  • Subject: Re: UITableCellView width decreases when scrolling
  • From: Luke the Hiesterman <email@hidden>
  • Date: Tue, 16 Apr 2013 11:27:43 -0700

I'm guessing you need to call [self setNeedsDisplay] in the implementation of -[MyCustomView setObject:]

Luke

On Apr 16, 2013, at 11:25 AM, Koen van der Drift <email@hidden>
 wrote:

>
> On Apr 15, 2013, at 7:20 AM, Koen van der Drift <email@hidden> wrote:
>
>> The reason I was using drawRect is that my cell contains some text, plus a small graph (a few changing lines, so I cannot use an static image) at the bottom. Therefore I was using CoreGraphics, and I decided then to also draw the strings that way.
>>
>> Even if I use labels for the strings (which I agree is much easier and customizable), then I still would need a subview for the bottom half of my contentView to draw in the graph. Unless there is another solution?
>
> I'm having some troubles with the custom view to draw my graph in.
>
> I created a xib for my cell with a bunch of labels and a UIView, as well as a UIView subclass (MyCustomView), where in the drawRect method I draw the graph.  The UIView in the xib is set to the Class MYCustomView.
>
> In the UITableViewController I added the following to set up the cell:
>
> - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
> {
>    MyCustomCell *cell = [tableView dequeueReusableCellWithIdentifier: @"MyCell"];
>
>    if (!cell)
>    {
>        cell = [[MyCustomCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: @"MyCell"];
>        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
>    }
>
>    MyObject *o = [self.myArray objectAtIndex: [indexPath row]];
>
>    cell.labelOne.text = o.name;
>    cell.labelTwo.text = o.info;
>
>    cell.myCustomView.object = o;
>
>    return cell;
> }
>
> And then in drawRect of MyCustomView I extract the info from the object to setup the draw parameters and draw my graph.
>
> Now the first few cells are drawn ok, but after that, I see the graph based on the info from an object that has already been drawn.  If I put in an NSLog in drawRect, I indeed see that this is called only a few times, and after that not anymore.  But labelOne and labelTwo are fine for all cells and called all the time.
>
>
> Why is drawRect only called for the first couple of cells, and after that not anymore?
>
>
> Thanks,
>
> - Koen.
>
>


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: UITableCellView width decreases when scrolling
      • From: Koen van der Drift <email@hidden>
References: 
 >UITableCellView width decreases when scrolling (From: Koen van der Drift <email@hidden>)
 >Re: UITableCellView width decreases when scrolling (From: Luke Hiesterman <email@hidden>)
 >Re: UITableCellView width decreases when scrolling (From: Koen van der Drift <email@hidden>)
 >Re: UITableCellView width decreases when scrolling (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: UITableCellView width decreases when scrolling
  • Next by Date: Re: UITableCellView width decreases when scrolling
  • Previous by thread: Re: UITableCellView width decreases when scrolling
  • Next by thread: Re: UITableCellView width decreases when scrolling
  • Index(es):
    • Date
    • Thread