mirror of
https://github.com/zhigang1992/RETableViewManager.git
synced 2026-06-19 18:24:13 +08:00
Move away from iVars to properties
This commit is contained in:
@@ -8,6 +8,13 @@
|
||||
|
||||
#import "ListHeaderView.h"
|
||||
|
||||
@interface ListHeaderView ()
|
||||
|
||||
@property (strong, readwrite, nonatomic) UIImageView *userpicImageView;
|
||||
@property (strong, readwrite, nonatomic) UILabel *usernameLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation ListHeaderView
|
||||
|
||||
+ (ListHeaderView *)headerViewWithImageNamed:(NSString *)imageNamed username:(NSString *)username
|
||||
@@ -29,14 +36,14 @@
|
||||
backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||
[self addSubview:backgroundView];
|
||||
|
||||
_userpicImageView = [[UIImageView alloc] initWithFrame:CGRectMake(7, 7, 30, 30)];
|
||||
[self addSubview:_userpicImageView];
|
||||
self.userpicImageView = [[UIImageView alloc] initWithFrame:CGRectMake(7, 7, 30, 30)];
|
||||
[self addSubview:self.userpicImageView];
|
||||
|
||||
_usernameLabel = [[UILabel alloc] initWithFrame:CGRectMake(45, 3, 276, 35)];
|
||||
_usernameLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
_usernameLabel.textColor = [UIColor blackColor];
|
||||
_usernameLabel.backgroundColor = [UIColor clearColor];
|
||||
[self addSubview:_usernameLabel];
|
||||
self.usernameLabel = [[UILabel alloc] initWithFrame:CGRectMake(45, 3, 276, 35)];
|
||||
self.usernameLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
self.usernameLabel.textColor = [UIColor blackColor];
|
||||
self.usernameLabel.backgroundColor = [UIColor clearColor];
|
||||
[self addSubview:self.usernameLabel];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
|
||||
#import "ListImageCell.h"
|
||||
|
||||
@interface ListImageCell ()
|
||||
|
||||
@property (strong, readwrite, nonatomic) UIImageView *pictureView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation ListImageCell
|
||||
|
||||
+ (CGFloat)heightWithItem:(NSObject *)item tableViewManager:(RETableViewManager *)tableViewManager
|
||||
@@ -18,15 +24,15 @@
|
||||
- (void)cellDidLoad
|
||||
{
|
||||
[super cellDidLoad];
|
||||
_pictureView = [[UIImageView alloc] initWithFrame:CGRectMake(7, 0, 306, 306)];
|
||||
_pictureView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
|
||||
[self addSubview:_pictureView];
|
||||
self.pictureView = [[UIImageView alloc] initWithFrame:CGRectMake(7, 0, 306, 306)];
|
||||
self.pictureView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
|
||||
[self addSubview:self.pictureView];
|
||||
}
|
||||
|
||||
- (void)cellWillAppear
|
||||
{
|
||||
[super cellWillAppear];
|
||||
[_pictureView setImage:[UIImage imageNamed:self.item.imageName]];
|
||||
[self.pictureView setImage:[UIImage imageNamed:self.item.imageName]];
|
||||
}
|
||||
|
||||
- (void)cellDidDisappear
|
||||
|
||||
Reference in New Issue
Block a user