
I’m switching to landscape and it redraws the UIButton. here is the button code.
plusButton = [[[UIButton alloc] initWithFrame:CGRectMake(bounds.size.width - 60.0f, 28.0f, 45.0f,90.0f)] autorelease ];
[plusButton setImage:TTIMAGE(@"bundle://morebutton.png")
forState:UIControlStateNormal];
[plusButton showsTouchWhenHighlighted];
[plusButton addTarget:self action:@selector(plusButtonDidPress:)
forControlEvents:UIControlEventTouchUpInside];
[self addSubview:plusButton];
This is a TTMessageitemcell (THREE20)
Any suggestions would be appreciated. thanks.
Is this being called in drawRect or something similar? It looks as if it’s creating a new instance of the button each time a drawing method is called. Try making plus button an instance variable of your cell and initialise it in the init method. Then you can set frame and other properties in the drawing method while only using one instance of the button. You can then release the button in dealloc.
tl;dr: looks as if you’re adding multiple instances of the button in a drawing method eg. drawRect: or layoutSubviews.
Tim