iphone - How can I replace the imageView in a UITableViewCell? -


I have a type that comes from the UIImageView but adds some extra functionality I can see it in my UITableViewCells But rather rather want to create a new cell layout, so that I can add this image.

When I try to set the image view directly ( self.imageView = myImageView ) I get a compilation telling me the error is that the imageView is read only. Is there any way around this or I need to write a new table view cell class

For more clarity:?

  @interface MyImageViewClass: UIImageView {} @end ====================== @interface MyTableCellClass: UITableViewCell {} @end @implementation MyTableCellClass - (zero) setupCell {MyImageView * imageView = [[[MyImageView alloc] init] autorelease]; Self.imageView = imageView; // & LT; There is a lot of options here ---- this is a compilation error thrown by an error code} @end    

.

  • You can insert your image view in the same room as a normal image view in the same place. WillDisplayCell: forRowAtIndexPath: in tableView , you can set the frame to see your image to match the default one (so you will get Apple's layout argument). After that simply set the image to your image cell instead of the default.

  • You can do this, but you can "steal" the image in tableView: willDisplayCell: .. . Just set myImageView.image = imageView.image and clear the image of imageView this will make it more transparent but a bit more magical.

  • Get fancy and give Jesus a imageView one type of alcoholic in his class. For work or for accidents you received, you should have no additional yvar or synthetic properties in your class will be bizarre. Search around for "ice swizzle" or "class swizzle"

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -